47 lines
1.9 KiB
C#
47 lines
1.9 KiB
C#
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) { }
|
||
}
|
||
}
|