chore(m2): 保存功能验收及后续清理前检查点
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
public interface IFootPrintService
|
||||
{
|
||||
public EFootPrint FootPrint { get; }
|
||||
@@ -11,27 +11,14 @@ public interface IFootPrintService
|
||||
// ReSharper disable once ClassNeverInstantiated.Global
|
||||
public class FootPrintService : IFootPrintService
|
||||
{
|
||||
[asap.core.Inject] public game.PlayerDataStorage.IPlayerSaveStore SaveStore { get; set; }
|
||||
[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)
|
||||
{
|
||||
@@ -41,15 +28,13 @@ public class FootPrintService : IFootPrintService
|
||||
|
||||
public void UploadData()
|
||||
{
|
||||
_kvCompleteFootPrint |= unchecked((uint)(int)_footPrint);
|
||||
var data = _kvCompleteFootPrint;
|
||||
var data = (ulong)_footPrint;
|
||||
SaveStore.Write("FootPrint", data.ToString()).RequireAccepted();
|
||||
}
|
||||
|
||||
public void LoadData(string data)
|
||||
{
|
||||
_kvCompleteFootPrint = ulong.Parse(data);
|
||||
_footPrint = unchecked((EFootPrint)(int)(uint)_kvCompleteFootPrint);
|
||||
_footPrint = (EFootPrint) ulong.Parse(data);
|
||||
}
|
||||
|
||||
public bool HasFootPrint(EFootPrint state)
|
||||
|
||||
Reference in New Issue
Block a user