feat: 存档系统增加退出节点保存时机
This commit is contained in:
@@ -137,6 +137,8 @@ namespace AibisDream.SaveSystem
|
||||
sceneSoName = request.SceneSoName,
|
||||
yarnProjectId = request.YarnProjectId,
|
||||
nodeName = request.NodeName,
|
||||
saveTrigger = request.SaveTrigger,
|
||||
resumeMode = request.ResumeMode,
|
||||
sceneName = request.SceneName,
|
||||
firstSeenOrder = existingMeta?.firstSeenOrder ?? NextFirstSeenOrder(),
|
||||
firstRecordedAt = existingMeta?.firstRecordedAt ?? now,
|
||||
@@ -215,10 +217,11 @@ namespace AibisDream.SaveSystem
|
||||
return false;
|
||||
}
|
||||
|
||||
var stateOnly = IsStateOnly(entry.Meta?.resumeMode);
|
||||
if (snapshot?.anchor == null
|
||||
|| string.IsNullOrWhiteSpace(snapshot.anchor.sceneSoName)
|
||||
|| string.IsNullOrWhiteSpace(snapshot.anchor.yarnProjectId)
|
||||
|| string.IsNullOrWhiteSpace(snapshot.anchor.nodeName))
|
||||
|| (!stateOnly && string.IsNullOrWhiteSpace(snapshot.anchor.nodeName)))
|
||||
{
|
||||
error = "快照缺少完整 Yarn anchor。";
|
||||
snapshot = null;
|
||||
@@ -229,7 +232,12 @@ namespace AibisDream.SaveSystem
|
||||
if (entry.Meta != null
|
||||
&& (!string.Equals(snapshot.anchor.sceneSoName, entry.Meta.sceneSoName, StringComparison.Ordinal)
|
||||
|| !string.Equals(snapshot.anchor.yarnProjectId, entry.Meta.yarnProjectId, StringComparison.Ordinal)
|
||||
|| !string.Equals(snapshot.anchor.nodeName, entry.Meta.nodeName, StringComparison.Ordinal)))
|
||||
|| (!stateOnly
|
||||
&& !string.Equals(
|
||||
snapshot.anchor.nodeName,
|
||||
entry.Meta.nodeName,
|
||||
StringComparison.Ordinal))
|
||||
|| (stateOnly && !string.IsNullOrEmpty(snapshot.anchor.nodeName))))
|
||||
{
|
||||
error = "快照 anchor 与 meta 不一致。";
|
||||
snapshot = null;
|
||||
@@ -457,6 +465,14 @@ namespace AibisDream.SaveSystem
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsStateOnly(string resumeMode)
|
||||
{
|
||||
return string.Equals(
|
||||
resumeMode,
|
||||
nameof(SaveResumeMode.StateOnly),
|
||||
StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private void RecoverTransactions()
|
||||
{
|
||||
if (!Directory.Exists(_rootPath))
|
||||
|
||||
Reference in New Issue
Block a user