Files
zeling_v2/Assets/Scripts/Support/Platform/NullPlatformService.cs
2026-05-12 15:34:08 +08:00

47 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Threading.Tasks;
using UnityEngine;
namespace BaseGames.Platform
{
/// <summary>
/// IPlatformService 的空实现,无平台 SDK 时作为默认服务使用。
/// 所有操作均为无操作no-op或返回安全默认值。
/// </summary>
public class NullPlatformService : IPlatformService
{
public bool IsInitialized => true;
public bool IsCloudAvailable => false;
public Task<bool> InitializeAsync() => Task.FromResult(true);
public void RunCallbacks() { }
public void Shutdown() { }
public void UnlockAchievement(string achievementId)
=> Debug.Log($"[NullPlatform] UnlockAchievement: {achievementId}");
public void ClearAchievement(string achievementId) { }
public Task<bool> IsAchievementUnlocked(string achievementId)
=> Task.FromResult(false);
public void SetStat(string statId, int value) { }
public void IncrementStat(string statId, int increment = 1) { }
public int GetStat(string statId) => 0;
public Task<bool> CloudSaveAsync(string fileName, byte[] data) => Task.FromResult(false);
public Task<byte[]> CloudLoadAsync(string fileName) => Task.FromResult<byte[]>(null);
public void SetRichPresence(string key, string value) { }
public void ClearRichPresence() { }
public void SubmitLeaderboardScore(string boardId, long score)
=> Debug.Log($"[NullPlatform] SubmitLeaderboardScore: {boardId} = {score}");
public Task<LeaderboardEntry[]> GetLeaderboardEntries(string boardId, int maxCount)
=> Task.FromResult(System.Array.Empty<LeaderboardEntry>());
public bool IsDLCOwned(string dlcId) => false;
public void ShowOverlay(string dialog) { }
}
}