chore(m2): 保存功能验收及后续清理前检查点
This commit is contained in:
@@ -68,19 +68,34 @@ namespace game
|
||||
}
|
||||
internal bool HasFormalPromptOwner(PlayerKVGameSessionHandle owner) =>
|
||||
requiresFormalKV && ReferenceEquals(promptOwner, owner);
|
||||
|
||||
internal void ReleaseFailedPromptOwner(PlayerKVGameSessionHandle owner)
|
||||
{
|
||||
if (promptOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!ReferenceEquals(promptOwner, owner) || owner.Status != PlayerKVSyncStatus.Closed)
|
||||
{
|
||||
throw PromptFailure("ShowNotice: failed owner has not closed.");
|
||||
}
|
||||
promptOwner = null;
|
||||
LastPromptEdit = null;
|
||||
_showNotice = null;
|
||||
}
|
||||
internal void RequirePromptOwner()
|
||||
{
|
||||
if (promptOwner != null) ReadPrompt();
|
||||
else if (requiresFormalKV) throw PromptFailure("ShowNotice: formal owner not handed off.");
|
||||
}
|
||||
|
||||
PlayerKVKeyReadResult ReadPrompt()
|
||||
private PlayerKVKeyReadResult ReadPrompt()
|
||||
{
|
||||
if (LastPromptEdit != null && !LastPromptEdit.Accepted)
|
||||
throw PromptFailure($"ShowNotice owner={promptOwner.OwnerInstanceId}: {LastPromptEdit.StateResult.Error}; uncertain={LastPromptEdit.StateResult.LocalCommitMayHaveSucceeded}");
|
||||
var read = KVMgr.ReadKV(promptOwner, "ShowNotice");
|
||||
if (!read.Success)
|
||||
{
|
||||
throw PromptFailure($"ShowNotice owner={promptOwner.OwnerInstanceId}: {read.Error}");
|
||||
}
|
||||
return read;
|
||||
}
|
||||
|
||||
@@ -162,11 +177,14 @@ namespace game
|
||||
{
|
||||
get
|
||||
{
|
||||
if (requiresFormalKV && promptOwner == null) RequirePromptOwner();
|
||||
if (requiresFormalKV && promptOwner == null)
|
||||
{
|
||||
RequirePromptOwner();
|
||||
}
|
||||
if (promptOwner != null)
|
||||
{
|
||||
var read = ReadPrompt();
|
||||
_showNotice = read.Found == true && read.Value == "1";
|
||||
_showNotice ??= read.Found == true && read.Value == "1";
|
||||
return _showNotice.Value;
|
||||
}
|
||||
_showNotice ??= PlayFabMgr.Instance.GetLocalData("ShowNotice") == "1";
|
||||
@@ -174,19 +192,23 @@ namespace game
|
||||
}
|
||||
set
|
||||
{
|
||||
if (requiresFormalKV && promptOwner == null) RequirePromptOwner();
|
||||
if (requiresFormalKV && promptOwner == null)
|
||||
{
|
||||
RequirePromptOwner();
|
||||
}
|
||||
if (promptOwner != null)
|
||||
{
|
||||
var read = ReadPrompt();
|
||||
var serialized = value ? "1" : "0";
|
||||
if (read.Found != true || read.Value != serialized)
|
||||
ReadPrompt();
|
||||
if (value != _showNotice)
|
||||
{
|
||||
LastPromptEdit = KVMgr.WriteKV(promptOwner, "ShowNotice", serialized);
|
||||
_showNotice = value;
|
||||
LastPromptEdit = KVMgr.WriteKV(promptOwner, "ShowNotice", value ? "1" : "0");
|
||||
if (!LastPromptEdit.Accepted)
|
||||
{
|
||||
throw PromptFailure($"ShowNotice owner={promptOwner.OwnerInstanceId}: {LastPromptEdit.StateResult.Error}; uncertain={LastPromptEdit.StateResult.LocalCommitMayHaveSucceeded}");
|
||||
}
|
||||
}
|
||||
RequirePromptOwner();
|
||||
_showNotice = value;
|
||||
return;
|
||||
}
|
||||
if (value != _showNotice)
|
||||
|
||||
Reference in New Issue
Block a user