保存独立KV用户服务、固定会话存档与原业务接线,以及C3d资料缓存和C3e本人统计写。 保留原PF/AGG路线、业务公式和时序;榜单读取、好友资料、公告、匹配及首场景闸仍待完成。 验证:ServiceHost两条件各33组646断言;Unity CLI Loop编译0错误269警告。 包含相关方案、评审裁决、测试及状态文档。未操作服务器、正式账号或打包。
75 lines
2.5 KiB
Plaintext
75 lines
2.5 KiB
Plaintext
using System;
|
|
public interface IFootPrintService
|
|
{
|
|
public EFootPrint FootPrint { get; }
|
|
public void UpdateFootPrint(EFootPrint newState);
|
|
public void UploadData();
|
|
public void LoadData(string data);
|
|
public bool HasFootPrint(EFootPrint state);
|
|
}
|
|
|
|
// ReSharper disable once ClassNeverInstantiated.Global
|
|
public class FootPrintService : IFootPrintService
|
|
{
|
|
[asap.core.Inject] public game.PlayerDataStorage.IPlayerSaveStore SaveStore { get; set; }
|
|
|
|
private EFootPrint _footPrint;
|
|
private ulong _kvCompleteFootPrint;
|
|
internal ulong CompleteFootPrintForKVValidation => _kvCompleteFootPrint;
|
|
internal static game.PlayerDataStorage.PlayerKVFootPrintState DecodeForKVLoad(
|
|
System.Collections.Generic.IReadOnlyDictionary<string, string> raw,
|
|
game.PlayerDataStorage.PlayerKVSchemaDiagnostics errors)
|
|
=> game.PlayerDataStorage.PlayerKVSaveSchema.DecodeFootPrint(raw, errors);
|
|
internal void ResetForKVLoad()
|
|
{
|
|
_kvCompleteFootPrint = 0;
|
|
_footPrint = 0;
|
|
}
|
|
internal void ReplaceFromKVDecoded(game.PlayerDataStorage.PlayerKVFootPrintState state)
|
|
{
|
|
if (state == null) throw new ArgumentNullException(nameof(state));
|
|
_kvCompleteFootPrint = state.Bits;
|
|
// This legacy view contains only the low 32 bits. The ulong field retains the complete KV state.
|
|
_footPrint = unchecked((EFootPrint)(int)(uint)state.Bits);
|
|
}
|
|
public EFootPrint FootPrint => _footPrint;
|
|
public void UpdateFootPrint(EFootPrint newState)
|
|
{
|
|
_footPrint |= newState;
|
|
UploadData();
|
|
}
|
|
|
|
public void UploadData()
|
|
{
|
|
_kvCompleteFootPrint |= unchecked((uint)(int)_footPrint);
|
|
var data = _kvCompleteFootPrint;
|
|
SaveStore.Write("FootPrint", data.ToString()).RequireAccepted();
|
|
}
|
|
|
|
public void LoadData(string data)
|
|
{
|
|
_kvCompleteFootPrint = ulong.Parse(data);
|
|
_footPrint = unchecked((EFootPrint)(int)(uint)_kvCompleteFootPrint);
|
|
}
|
|
|
|
public bool HasFootPrint(EFootPrint state)
|
|
{
|
|
return (_footPrint & state) == state;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Record Status. Max out at 64th record.
|
|
/// </summary>
|
|
[Flags]
|
|
public enum EFootPrint : int
|
|
{
|
|
HasCommunityGuidancePanelBeenOpened = 1 << 0,
|
|
IsFaceBookRewardClaimed = 1 << 1,
|
|
IsInstagramRewardClaimed = 1 << 2,
|
|
IsDiscordRewardClaimed = 1 << 3,
|
|
IsTiktokRewardClaimed = 1 << 4,
|
|
IsYouTubeRewardClaimed = 1 << 5,
|
|
IsEventCanGuidePoped = 1 << 6,
|
|
IsFaceBookRewardLink = 1 << 7,
|
|
}
|