Files
zeling_v2/Assets/_Game/Scripts/Dialogue/IDialogueService.cs
Joywayer c7057db27d fix: Round 56 亲密度门槛UI、空npcId警告、任务总览窗口、超时缓存、本地化Key检查、放弃任务交互、CurrentNpcId属性
- QuestManager.ApplyAffinity: giverNpc.npcId 为空时改为 LogWarning+return,不再静默丢弃好感度奖励
- QuestManager.UnlockBranches: 分支对话 npcId 为空时输出 LogWarning,提示开发者可能误推进对话类目标
- QuestGiver.InteractPrompt: Available 状态调用 GetQuestLockInfo,亲密度/前置未满足时显示锁定原因而非'接受任务'
- QuestGiver.Interact_Internal: Available 状态加锁定检查防卫,锁定时提前返回;新增 _allowAbandon 字段(默认 false)
- QuestGiver: Active+未完成+_allowAbandon=true 时显示'放弃任务'并触发 AbandonQuest,接入已有 AbandonQuest 接口
- DialogueManager: 新增 _waitSequenceTimeout 缓存字段,Awake 预创建避免每次 PlayImmediate 分配 WaitForSeconds
- DialogueManager: 新增 _currentNpcId 字段,PlayImmediate 写入、EndDialogue/ForceEnd 清空
- IDialogueService + DialogueManager: 暴露 CurrentNpcId 只读属性,供外部系统主动查询当前对话 NPC
- QuestSO.OnValidate: 对空 displayNameKey/descriptionKey 输出 LogWarning,防止 UI 显示空文本
- 新增 QuestOverviewEditorWindow: BaseGames/Quest/Quest Overview,列出全部 QuestSO,支持搜索/分类过滤;
  Play Mode 下读取 IQuestManager 运行时状态并着色显示;Edit Mode 高亮配置错误行;单击 Ping、双击 Select

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-25 08:06:54 +08:00

48 lines
2.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace BaseGames.Dialogue
{
/// <summary>
/// 对话服务接口。通过 ServiceLocator 注册,供 NPC 和测试使用。
/// </summary>
public interface IDialogueService
{
/// <summary>当前是否有对话正在播放。</summary>
bool IsDialogueActive { get; }
/// <summary>
/// 当前正在播放对话的 NPC ID。无对话活跃时为 <see langword="null"/>。
/// 供地图标记、HUD、分析埋点等外部系统主动查询无需订阅事件。
/// </summary>
string CurrentNpcId { get; }
/// <summary>
/// 每次对话序列(含分支链)全部播完后触发。
/// 测试代码可订阅此事件等待对话结束,无需依赖 VoidEventChannelSO 资产。
/// </summary>
event System.Action OnDialogueEnded;
/// <summary>
/// 启动对话序列。
/// 若已有对话在播放priority 高于当前对话时立即打断;否则进入队列(上限 8超出丢弃。
/// </summary>
/// <param name="sequence">要播放的对话序列 SO。</param>
/// <param name="npcId">NPC 标识符,对话结束时随 EVT_NpcDialogueCompleted 广播。</param>
/// <param name="priority">优先级(默认 0。数值越大越优先高优先级可打断低优先级对话。</param>
void StartDialogue(DialogueSequenceSO sequence, string npcId = "", int priority = 0);
/// <summary>
/// 启动对话序列,并在本次对话(含所有排队续播)全部结束时回调 <paramref name="onComplete"/>。
/// 若 <paramref name="onComplete"/> 为 null行为与 <see cref="StartDialogue(DialogueSequenceSO,string,int)"/> 完全相同。
/// 回调仅触发一次;若对话被 <see cref="ForceEnd"/> 打断,回调同样会被调用(在 ForceEnd 末尾)。
/// 适用场景EventChain 触发对话后等待完成再执行下一动作、CutsceneModule 同步对话与演出。
/// </summary>
void StartDialogue(DialogueSequenceSO sequence, string npcId, int priority, System.Action onComplete);
/// <summary>
/// 立即强制结束当前对话(含清空等待队列),恢复游戏输入。
/// 适用于:场景切换、演出系统打断、死亡/传送等需要硬中断的场合。
/// 若当前没有活跃对话,则无操作。
/// </summary>
void ForceEnd();
}
}