feat(upserver): 接入认证与KV存档并完成限定钓鱼闭环

This commit is contained in:
Liubing\LB
2026-09-28 18:14:01 +08:00
parent f40a816cc4
commit 0eb43b2b40
129 changed files with 11612 additions and 573 deletions

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace game.PlayerDataStorage
{
// Only two approved in-memory normalizations. Never a persistence receipt or retry queue.
internal sealed class PlayerKVInitializationIntents
{
readonly Dictionary<string,string> values=new Dictionary<string,string>(StringComparer.Ordinal);
readonly string channel;
internal long Epoch { get; }
internal bool Discarded { get; private set; }
internal int DiscardedCount { get; private set; }
internal int Count => values.Count;
internal IReadOnlyDictionary<string,string> Snapshot => new ReadOnlyDictionary<string,string>(new Dictionary<string,string>(values));
internal PlayerKVInitializationIntents(long epoch,PlayerKVIdentityChannel channel)
{
if(!Enum.IsDefined(typeof(PlayerKVIdentityChannel),channel)) throw new ArgumentException("Unknown intent channel.");
Epoch=epoch; this.channel=channel==PlayerKVIdentityChannel.hwGuest || channel==PlayerKVIdentityChannel.none ? null : channel.ToString();
}
internal void Add(long epoch,string key,string value)
{
if(Discarded || epoch!=Epoch || key==null || (key!="MMTest" && key!=channel) || value==null)
throw new InvalidOperationException("Initialization intent rejected.");
values[key]=value;
}
internal void Discard() { if(Discarded) return; DiscardedCount=values.Count; values.Clear(); Discarded=true; }
}
}