fix: Round 55 递归硬中止、存档加载缓存刷新、好感度空值防护、选项穿透延迟、分支对话去重
- QuestSO.HasPrerequisiteCycle/HasBranchCycle: depth>32 改为 LogError+return true 硬中止,防止栈溢出 - DialogueSequenceSO.HasChoiceCycle: 新增 depth 参数及 >32 硬中止,同时更新递归调用传 depth+1 - IQuestEventSource: 新增 OnAfterSaveLoaded 事件接口,供存档加载后统一刷新缓存 - QuestManager.OnLoad: 末尾触发 OnAfterSaveLoaded,确保所有缓存组件收到通知 - QuestGiver: 订阅 OnAfterSaveLoaded 设 _cacheDirty,存档恢复后 NPC 交互提示始终最新 - QuestManager.ApplyAffinity: 新增 giverNpc null 显式 LogWarning、maxAffinity<0 LogError 防护 - DialogueManager: 选项穿透防护改为预创建 WaitForSeconds(0.15f),替代 yield return null - QuestManager.UnlockBranches: 多分支同时满足时只播首个有对话的分支,防止重复播放 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -188,8 +188,8 @@ namespace BaseGames.Quest
|
||||
{
|
||||
if (depth > 32)
|
||||
{
|
||||
Debug.LogWarning($"[QuestSO] 前置链深度超过 32 层(路径末端:'{quest.name}'),已停止检测。请减少任务链深度。");
|
||||
return false;
|
||||
Debug.LogError($"[QuestSO] 前置链深度超过 32 层(路径末端:'{quest.name}'),已视为存在循环依赖并中止检测。请减少任务链深度。");
|
||||
return true;
|
||||
}
|
||||
if (string.IsNullOrEmpty(quest.questId)) return false;
|
||||
if (!visited.Add(quest.questId)) return true; // 已在当前路径上 = 环路
|
||||
@@ -242,8 +242,8 @@ namespace BaseGames.Quest
|
||||
{
|
||||
if (depth > 32)
|
||||
{
|
||||
Debug.LogWarning($"[QuestSO] 分支链深度超过 32 层(路径末端:'{quest.name}'),已停止检测。请减少分支链深度。");
|
||||
return false;
|
||||
Debug.LogError($"[QuestSO] 分支链深度超过 32 层(路径末端:'{quest.name}'),已视为存在循环依赖并中止检测。请减少分支链深度。");
|
||||
return true;
|
||||
}
|
||||
if (string.IsNullOrEmpty(quest.questId)) return false;
|
||||
if (!visited.Add(quest.questId)) return true; // 已在路径上 = 环路
|
||||
|
||||
Reference in New Issue
Block a user