feat: Round 50 narrative systems improvements
IQuestManager+QuestManager: add FillQuestsInState/FillFilterQuests buffer overloads (no-alloc hot path); remove R49 duplicate implementations. QuestGiver: cache current quest result (_cachedQuest/_cachedState/_cacheDirty) to avoid per-frame foreach in InteractPrompt; invalidate on OnEnable and Interact_Internal state changes. IDialogueService+DialogueManager: add StartDialogue(..., Action onComplete) overload; callback fires once on ForceEnd (covers both normal end and interrupt); supports chained callbacks via += accumulation. DialogueVariantPreviewWindow: add 'Copy CSV' button in matrix section; exports all 2^N flag combinations with winner column; handles N>10 guard and CSV-safe escaping. WorldStateRegistry: add TryGetCategory(id, out category) reverse lookup for debug tools. NpcSOEditor: new CustomEditor for NpcSO showing live nameKey localization preview in Inspector (green label or warning box if Key not found). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -153,5 +153,22 @@ namespace BaseGames.World
|
||||
|
||||
/// <summary>重置所有状态(开始新游戏时调用)。</summary>
|
||||
public void Reset() => _states.Clear();
|
||||
|
||||
/// <summary>
|
||||
/// 反向查询:在所有分类中查找 <paramref name="id"/> 首次出现的类别。
|
||||
/// 适用于调试工具(如 DataHub / WorldState 检视面板)快速定位一个 id 属于哪类。
|
||||
/// O(k) 其中 k = 分类数(最多 5)。
|
||||
/// </summary>
|
||||
/// <param name="id">要查找的 ID。</param>
|
||||
/// <param name="category">找到时输出该 ID 所属的类别;未找到时输出 <see cref="WorldObjectCategory.Flag"/>(默认值)。</param>
|
||||
/// <returns>true = 找到;false = 任何类别中均无此 id。</returns>
|
||||
public bool TryGetCategory(string id, out WorldObjectCategory category)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
foreach (var (cat, set) in _states)
|
||||
if (set.Contains(id)) { category = cat; return true; }
|
||||
category = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user