feat(upserver): 接入认证与KV存档并完成限定钓鱼闭环
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace game.PlayerDataStorage
|
||||
{
|
||||
public enum PlayerKVLocalReadError { None, StaleOrClosing, NotReady }
|
||||
|
||||
/// <summary>A detached snapshot. Failed reads have no data, never a pretend empty save.</summary>
|
||||
public sealed class PlayerKVLocalReadResult
|
||||
{
|
||||
public bool Success => Error == PlayerKVLocalReadError.None;
|
||||
public PlayerKVLocalReadError Error { get; }
|
||||
public string OwnerInstanceId { get; }
|
||||
public string PlayerId { get; }
|
||||
public long Epoch { get; }
|
||||
public IReadOnlyDictionary<string, string> Data { get; }
|
||||
|
||||
internal PlayerKVLocalReadResult(PlayerKVLocalReadError error, string ownerId,
|
||||
string playerId, long epoch, IReadOnlyDictionary<string, string> data = null)
|
||||
{
|
||||
Error = error; OwnerInstanceId = ownerId; PlayerId = playerId; Epoch = epoch;
|
||||
if (error != PlayerKVLocalReadError.None) return;
|
||||
if (data == null) throw new ArgumentNullException(nameof(data));
|
||||
var copy = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
foreach (var item in data) copy.Add(item.Key, item.Value);
|
||||
Data = new ReadOnlyDictionary<string, string>(copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user