feat(upserver): 保存M2客户端KV迁移至本人统计写检查点
保存独立KV用户服务、固定会话存档与原业务接线,以及C3d资料缓存和C3e本人统计写。 保留原PF/AGG路线、业务公式和时序;榜单读取、好友资料、公告、匹配及首场景闸仍待完成。 验证:ServiceHost两条件各33组646断言;Unity CLI Loop编译0错误269警告。 包含相关方案、评审裁决、测试及状态文档。未操作服务器、正式账号或打包。
This commit is contained in:
@@ -9,6 +9,10 @@ namespace Activity.Data
|
||||
/// </summary>
|
||||
public class EventDataRepository : IEventDataRepository
|
||||
{
|
||||
private readonly game.PlayerDataStorage.IPlayerSaveStore store;
|
||||
public EventDataRepository(game.PlayerDataStorage.IPlayerSaveStore store)
|
||||
{ this.store = store ?? throw new ArgumentNullException(nameof(store)); }
|
||||
|
||||
public void Save<T>(T data) where T : IEventData
|
||||
{
|
||||
if (data == null)
|
||||
@@ -23,7 +27,7 @@ namespace Activity.Data
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"[EventDataRepository] Saving {typeof(T).Name}: {json}");
|
||||
#endif
|
||||
PlayFabMgr.Instance?.UpdateUserDataValue(typeof(T).Name, json);
|
||||
store.Write(typeof(T).Name, json).RequireAccepted();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -35,7 +39,7 @@ namespace Activity.Data
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataStr = PlayFabMgr.Instance?.GetLocalData(typeof(T).Name);
|
||||
var dataStr = store.Read(typeof(T).Name).ValueOrThrow();
|
||||
if (string.IsNullOrEmpty(dataStr)) return new T();
|
||||
// #if UNITY_EDITOR
|
||||
// Debug.Log($"[EventDataRepository] Load {typeof(T).Name}: {dataStr}");
|
||||
@@ -52,7 +56,7 @@ namespace Activity.Data
|
||||
|
||||
public bool Exists<T>() where T : IEventData
|
||||
{
|
||||
var dataStr = PlayFabMgr.Instance?.GetLocalData(typeof(T).Name);
|
||||
var dataStr = store.Read(typeof(T).Name).ValueOrThrow();
|
||||
return !string.IsNullOrEmpty(dataStr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,10 @@ namespace Activity.Services
|
||||
/// </summary>
|
||||
public class EventTokenService : IEventTokenService
|
||||
{
|
||||
private readonly game.PlayerDataStorage.IPlayerSaveStore store;
|
||||
public EventTokenService(game.PlayerDataStorage.IPlayerSaveStore store)
|
||||
{ this.store = store ?? throw new ArgumentNullException(nameof(store)); }
|
||||
|
||||
#region 常量与字段
|
||||
|
||||
private const string TransitionDataKey = "TransitionData";
|
||||
@@ -75,7 +79,7 @@ namespace Activity.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataStr = PlayFabMgr.Instance?.GetLocalData(TransitionDataKey);
|
||||
var dataStr = store.Read(TransitionDataKey).ValueOrThrow();
|
||||
if (!string.IsNullOrEmpty(dataStr))
|
||||
{
|
||||
_tokenData.Clear();
|
||||
@@ -106,7 +110,7 @@ namespace Activity.Services
|
||||
try
|
||||
{
|
||||
var json = Newtonsoft.Json.JsonConvert.SerializeObject(_tokenData);
|
||||
PlayFabMgr.Instance?.UpdateUserDataValue(TransitionDataKey, json);
|
||||
store.Write(TransitionDataKey, json).RequireAccepted();
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"[EventTokenService] Saved {_tokenData.Count} token entries to PlayFab");
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user