feat(upserver): 保存M2客户端KV迁移至本人统计写检查点
保存独立KV用户服务、固定会话存档与原业务接线,以及C3d资料缓存和C3e本人统计写。 保留原PF/AGG路线、业务公式和时序;榜单读取、好友资料、公告、匹配及首场景闸仍待完成。 验证:ServiceHost两条件各33组646断言;Unity CLI Loop编译0错误269警告。 包含相关方案、评审裁决、测试及状态文档。未操作服务器、正式账号或打包。
This commit is contained in:
@@ -16,6 +16,8 @@ namespace game
|
||||
GContext.OnEvent<TargetEvent>().Subscribe(OnEvent_TargetEvent).AddTo(Disposables);
|
||||
}
|
||||
private Tables _tables;
|
||||
[Inject] public PlayerDataStorage.IPlayerSaveStore SaveStore { get; set; }
|
||||
bool disposed;
|
||||
|
||||
[Inject]
|
||||
public Tables Tables
|
||||
@@ -28,6 +30,7 @@ namespace game
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
disposed = true;
|
||||
Disposables?.Dispose();
|
||||
}
|
||||
|
||||
@@ -38,6 +41,7 @@ namespace game
|
||||
|
||||
protected virtual void OnEvent_TargetEvent(TargetEvent targetEvent)
|
||||
{
|
||||
if (disposed || SaveStore == null || !SaveStore.IsCurrent) return;
|
||||
if (targetEvent.type == EventType && targetEvent.subType == EventSubType) RefreshData(targetEvent.id);
|
||||
}
|
||||
|
||||
@@ -54,7 +58,8 @@ namespace game
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"jsd {typeof(T).Name} SaveData {JsonConvert.SerializeObject(Data)}");
|
||||
#endif
|
||||
PlayFabMgr.Instance.UpdateUserDataValue(typeof(T).Name, JsonConvert.SerializeObject(Data));
|
||||
if (disposed) throw new ObjectDisposedException(GetType().Name);
|
||||
SaveStore.Write(typeof(T).Name, JsonConvert.SerializeObject(Data)).RequireAccepted();
|
||||
}
|
||||
|
||||
protected virtual void SaveData(T data)
|
||||
@@ -62,7 +67,8 @@ namespace game
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"jsd {typeof(T).Name} SaveData {JsonConvert.SerializeObject(data)}");
|
||||
#endif
|
||||
PlayFabMgr.Instance.UpdateUserDataValue(typeof(T).Name, JsonConvert.SerializeObject(data));
|
||||
if (disposed) throw new ObjectDisposedException(GetType().Name);
|
||||
SaveStore.Write(typeof(T).Name, JsonConvert.SerializeObject(data)).RequireAccepted();
|
||||
}
|
||||
|
||||
protected virtual void RefreshData(int eventId)
|
||||
@@ -82,7 +88,8 @@ namespace game
|
||||
|
||||
protected T GetCacheData()
|
||||
{
|
||||
var dataStr = PlayFabMgr.Instance.GetLocalData(typeof(T).Name);
|
||||
if (disposed) throw new ObjectDisposedException(GetType().Name);
|
||||
var dataStr = SaveStore.Read(typeof(T).Name).ValueOrThrow();
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"jsd {typeof(T).Name} LoadData sData {dataStr}");
|
||||
#endif
|
||||
@@ -133,4 +140,4 @@ namespace game
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user