feat(upserver): 保存M2客户端KV迁移至本人统计写检查点

保存独立KV用户服务、固定会话存档与原业务接线,以及C3d资料缓存和C3e本人统计写。
保留原PF/AGG路线、业务公式和时序;榜单读取、好友资料、公告、匹配及首场景闸仍待完成。

验证:ServiceHost两条件各33组646断言;Unity CLI Loop编译0错误269警告。
包含相关方案、评审裁决、测试及状态文档。未操作服务器、正式账号或打包。
This commit is contained in:
Liubing\LB
2026-09-30 19:19:05 +08:00
parent 1c0cdf7a99
commit 6813da149a
511 changed files with 151858 additions and 2376 deletions

View File

@@ -0,0 +1,45 @@
using System;
using System.Globalization;
namespace game.PlayerDataStorage
{
/// <summary>
/// Immutable process-start selection. Accounts 101 and 102 are the reviewed first cohort;
/// expanding it requires a new complete migration design review.
/// </summary>
internal sealed class PlayerKVRuntimeSelection
{
internal const string FormalApiUrl = "http://s101.local:18080/";
internal bool IsKV { get; }
internal Uri Api { get; }
private PlayerKVRuntimeSelection(bool isKV, Uri api)
{
IsKV = isKV;
Api = api;
}
internal static PlayerKVRuntimeSelection Capture(string backend, string api, bool agg)
{
if (backend == null || backend == "playfab")
return new PlayerKVRuntimeSelection(false, null);
if (backend != "kv")
throw new ArgumentException("Unsupported save backend.", nameof(backend));
if (agg)
throw new InvalidOperationException("KV login is not enabled for AGG channels.");
if (!string.Equals(api, FormalApiUrl, StringComparison.Ordinal))
throw new ArgumentException("KV API address does not match the reviewed endpoint.", nameof(api));
return new PlayerKVRuntimeSelection(true, new Uri(FormalApiUrl));
}
internal bool TryAdmitPlayer(string requestedId, out string canonicalId)
{
canonicalId = null;
if (!IsKV || !long.TryParse(requestedId, NumberStyles.None, CultureInfo.InvariantCulture, out var id) ||
(id != 101 && id != 102)) return false;
canonicalId = id.ToString(CultureInfo.InvariantCulture);
return true;
}
}
}