feat(upserver): 保存M2客户端KV迁移至本人统计写检查点
保存独立KV用户服务、固定会话存档与原业务接线,以及C3d资料缓存和C3e本人统计写。 保留原PF/AGG路线、业务公式和时序;榜单读取、好友资料、公告、匹配及首场景闸仍待完成。 验证:ServiceHost两条件各33组646断言;Unity CLI Loop编译0错误269警告。 包含相关方案、评审裁决、测试及状态文档。未操作服务器、正式账号或打包。
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
using AppsFlyerSDK;
|
||||
using asap.core;
|
||||
using asap.core.common;
|
||||
@@ -24,10 +24,22 @@ using UnityEngine.Rendering.Universal;
|
||||
|
||||
public class SubBoostrap
|
||||
{
|
||||
internal static game.PlayerDataStorage.PlayerKVRuntimeSelection RuntimeSelection { get; private set; }
|
||||
|
||||
public static async System.Threading.Tasks.Task RegisterServices(GameObject rootCtxGo)
|
||||
public static async System.Threading.Tasks.Task RegisterServices(GameObject rootCtxGo, IConfig config)
|
||||
{
|
||||
if(config==null) throw new ArgumentNullException(nameof(config));
|
||||
#if AGG
|
||||
const bool aggBuild=true;
|
||||
#else
|
||||
const bool aggBuild=false;
|
||||
#endif
|
||||
var selection=game.PlayerDataStorage.PlayerKVRuntimeSelection.Capture(
|
||||
config.Get<string>("SaveBackend","playfab"),
|
||||
config.Get<string>(GConstant.K_Event_API_URL,game.Account.S101AccountSession.DefaultApiUrl),aggBuild);
|
||||
RuntimeSelection=selection;
|
||||
var container = GContext.container;
|
||||
container.RegisterInstance(selection);
|
||||
VibrationController vibrationController = new VibrationController();
|
||||
vibrationController.Init();
|
||||
container.RegisterInstance(vibrationController);
|
||||
@@ -88,7 +100,7 @@ public class SubBoostrap
|
||||
#if UNITY_EDITOR && !SERVICE_HOST
|
||||
game.PlayerDataStorage.PlayerKVGameplayLoop.BeforeBootstrap();
|
||||
#endif
|
||||
rootCtxGo.AddComponent<PlayFabMgr>();
|
||||
if(!selection.IsKV) rootCtxGo.AddComponent<PlayFabMgr>();
|
||||
// TODO Replace DataCenter with seprated data class
|
||||
// Create();
|
||||
// -----------------------------------------
|
||||
@@ -118,7 +130,7 @@ public class SubBoostrap
|
||||
GContext.container.Register<IRTService, SignalRService>().AsSingleton();
|
||||
GContext.container.RegisterInstance(new AvatarService());
|
||||
|
||||
var settings = new DefaultSettingService();
|
||||
var settings = new DefaultSettingService(RuntimeSelection?.IsKV == true);
|
||||
settings.Init(tables);
|
||||
GContext.container.RegisterInstance<ISettingService>(settings);
|
||||
GameCore.LocalizationMgr.Init();
|
||||
@@ -363,6 +375,21 @@ public class InternalEditorBoost
|
||||
}
|
||||
private async Task Init()
|
||||
{
|
||||
var selection = GContext.container.Resolve<game.PlayerDataStorage.PlayerKVRuntimeSelection>();
|
||||
if (selection == null)
|
||||
{
|
||||
var startupConfig = GContext.container.Resolve<IConfig>();
|
||||
var backend = startupConfig?.Get<string>("SaveBackend", "playfab");
|
||||
if (!string.Equals(backend, "playfab", StringComparison.Ordinal))
|
||||
throw new InvalidOperationException("Editor direct scene boot only supports playfab; KV requires RegisterServices.");
|
||||
// Editor direct scene boot is PF-only; KV and kv-loop must use RegisterServices.
|
||||
selection = game.PlayerDataStorage.PlayerKVRuntimeSelection.Capture("playfab", null, false);
|
||||
GContext.container.RegisterInstance(selection);
|
||||
if (!ReferenceEquals(GContext.container.Resolve<game.PlayerDataStorage.PlayerKVRuntimeSelection>(), selection))
|
||||
throw new InvalidOperationException("Editor backend selection registration failed.");
|
||||
}
|
||||
if (selection.IsKV)
|
||||
throw new InvalidOperationException("Editor direct scene boot cannot reuse a KV selection.");
|
||||
var tables = await cfg.Tables.Init(x => { Debug.Log(x); });
|
||||
GContext.container.RegisterInstance(tables);
|
||||
GContext.container.Register<IFaceUIService, FaceUIService>().AsSingleton();
|
||||
@@ -376,6 +403,7 @@ public class InternalEditorBoost
|
||||
|
||||
using (var scope = GContext.container.InjectionScope())
|
||||
{
|
||||
GContext.container.Register<game.PlayerDataStorage.IPlayerSaveStore, game.PlayerDataStorage.PlayFabPlayerSaveStore>().AsSingleton();
|
||||
// IAdsService 在 AfterAssetUpdate 中手动注册并调用 Init(),此处不再重复注册
|
||||
GContext.container.Register<PlayerFishData>().AsSingleton();
|
||||
GContext.container.Register<PlayerItemData>().AsSingleton();
|
||||
@@ -421,7 +449,7 @@ public class InternalEditorBoost
|
||||
GContext.container.Register<Activity.ActivityScopeManager>().AsSingleton();
|
||||
GContext.container.Register<TimeRefreshManager>().AsSingleton();
|
||||
}
|
||||
var settings = new DefaultSettingService();
|
||||
var settings = new DefaultSettingService(selection.IsKV);
|
||||
settings.Init(tables);
|
||||
GContext.container.RegisterInstance<ISettingService>(settings);
|
||||
GameCore.LocalizationMgr.Init();
|
||||
|
||||
Reference in New Issue
Block a user