feat: Round 52 narrative systems improvements
P1-A: QuestManager.OnLoad Enum.TryParse failure warning (dev builds)
P1-B: SaveData.QuestState ObjectiveCompleted dict; BuildObjectiveCompleted
helper; OnSave/OnLoad wiring (DataVersion 2→3)
P2-A: Quest start/complete timestamps (_startedAtUtc/_completedAtUtc dicts;
StartedAtUtc/CompletedAtUtc in SaveData; AcceptQuest/CompleteQuest/
OnSave/OnLoad wiring)
P2-B: DialogueManager pending queue Queue→List + priority-eviction on full
(lowest-priority item evicted when higher-priority request arrives)
P2-C: NpcSO.localizationTable field; NpcSOEditor uses npc.localizationTable
in TryResolveNameKey, PingLocalizationFile, and button label
P3-A: QuestSO.failConditions[] multi-fail array; Obsolete failCondition;
DispatchEvent updates fail check to any-of-array logic with fallback
P3-B: QuestObjectiveSO.prerequisiteObjectiveId; DispatchEvent gates objective
event routing behind prerequisite completed check
P3-C: IQuestEventPayload interface + StringQuestPayload struct; QuestObjectiveSO
typed TryHandleEvent(IQuestEventPayload) overload; DispatchEvent string
overload delegates to typed IQuestEventPayload overload
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -175,6 +175,34 @@ namespace BaseGames.Quest
|
||||
event Action<string, QuestStateEnum, QuestStateEnum> OnQuestStateChanged;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// IQuestEventPayload ── 强类型事件载荷接口
|
||||
// =========================================================================
|
||||
|
||||
/// <summary>
|
||||
/// 任务事件载荷接口,用于 <see cref="QuestManager"/> 强类型 <c>DispatchEvent</c> 重载。
|
||||
/// 实现此接口可在不修改 <see cref="QuestObjectiveSO.TryHandleEvent"/> 原有 string 签名的前提下,
|
||||
/// 逐步迁移到类型安全的载荷传递。
|
||||
/// </summary>
|
||||
public interface IQuestEventPayload
|
||||
{
|
||||
/// <summary>以字符串形式返回载荷内容,兼容旧版 TryHandleEvent(string payload) 签名。</summary>
|
||||
string AsString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字符串载荷适配器。封装现有 string payload,使其可作为 <see cref="IQuestEventPayload"/> 传递。
|
||||
/// 旧版 <c>DispatchEvent(QuestEventType, string)</c> 内部通过此结构透明转换,不破坏现有调用方。
|
||||
/// </summary>
|
||||
public readonly struct StringQuestPayload : IQuestEventPayload
|
||||
{
|
||||
private readonly string _value;
|
||||
public StringQuestPayload(string value) => _value = value;
|
||||
/// <inheritdoc/>
|
||||
public string AsString() => _value;
|
||||
public static implicit operator StringQuestPayload(string s) => new StringQuestPayload(s);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
/// <summary>
|
||||
/// 任务调试接口(仅编辑器 / 开发构建可用)。
|
||||
|
||||
Reference in New Issue
Block a user