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:
2026-05-25 00:24:20 +08:00
parent 3c3ea1ead6
commit 9c1e70fdeb
8 changed files with 283 additions and 37 deletions

View File

@@ -534,6 +534,42 @@ namespace BaseGames.Quest
return CheckQuestDepsAndFlags(quest);
}
/// <inheritdoc cref="IQuestManager.GetQuestsInState"/>
public IReadOnlyList<string> GetQuestsInState(QuestStateEnum state)
{
var result = new List<string>();
FillQuestsInState(state, result);
return result;
}
/// <inheritdoc cref="IQuestManager.FilterQuests"/>
public IReadOnlyList<string> FilterQuests(Func<string, QuestStateEnum, bool> predicate)
{
if (predicate == null) return Array.Empty<string>();
var result = new List<string>();
FillFilterQuests(predicate, result);
return result;
}
/// <inheritdoc cref="IQuestManager.FillQuestsInState"/>
public void FillQuestsInState(QuestStateEnum state, List<string> result)
{
if (result == null) return;
result.Clear();
foreach (var (id, s) in _questStates)
if (s == state) result.Add(id);
}
/// <inheritdoc cref="IQuestManager.FillFilterQuests"/>
public void FillFilterQuests(Func<string, QuestStateEnum, bool> predicate, List<string> result)
{
if (result == null) return;
result.Clear();
if (predicate == null) return;
foreach (var (id, s) in _questStates)
if (predicate(id, s)) result.Add(id);
}
#if UNITY_EDITOR || DEVELOPMENT_BUILD
// ── IQuestDebugger ────────────────────────────────────────────────────
@@ -797,25 +833,6 @@ namespace BaseGames.Quest
return new QuestLockInfo { Reason = QuestLockReason.None };
}
/// <inheritdoc cref="IQuestManager.GetQuestsInState"/>
public System.Collections.Generic.IReadOnlyList<string> GetQuestsInState(QuestStateEnum state)
{
var result = new List<string>();
foreach (var (id, s) in _questStates)
if (s == state) result.Add(id);
return result;
}
/// <inheritdoc cref="IQuestManager.FilterQuests"/>
public System.Collections.Generic.IReadOnlyList<string> FilterQuests(System.Func<string, QuestStateEnum, bool> predicate)
{
if (predicate == null) return System.Array.Empty<string>();
var result = new List<string>();
foreach (var (id, state) in _questStates)
if (predicate(id, state)) result.Add(id);
return result;
}
/// <summary>
/// 根据 flags 数组和 logic 评估标志前置条件是否满足。
/// </summary>