65 lines
2.8 KiB
C#
65 lines
2.8 KiB
C#
using System;
|
|
using AibisDream.Framework;
|
|
using AibisDream.Kit;
|
|
using AibisDream.Utility;
|
|
using UnityEngine;
|
|
using Yarn.Unity;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class LineView : DialogueViewBase
|
|
{
|
|
public override void RunLine(LocalizedLine dialogueLine, Action onDialogueLineFinished)
|
|
{
|
|
string lineId = dialogueLine.TextID;
|
|
string shortText = dialogueLine.TextWithoutCharacterName.Text.Length > 30
|
|
? dialogueLine.TextWithoutCharacterName.Text.Substring(0, 30) + "..."
|
|
: dialogueLine.TextWithoutCharacterName.Text;
|
|
|
|
Debug.Log($"[对话流程] [{lineId}] ===== 开始处理 =====");
|
|
Debug.Log($"[对话流程] [{lineId}] 文本内容: {shortText}");
|
|
|
|
EnumEventSystem.Global.Send(DialogEventEnum.LineStart, DialogText.GetLine(dialogueLine));
|
|
|
|
HandleLineOutput(dialogueLine, onDialogueLineFinished);
|
|
|
|
if (DialogController.Instance.quickRunMode)
|
|
{
|
|
Debug.Log($"[快速模式] [{lineId}] ===== 快速处理开始 =====");
|
|
|
|
// 快速模式:直接跳过文本显示并继续
|
|
bool skipResult = DialogCanvasManager.Instance.TrySkipLine(true);
|
|
Debug.Log($"[快速模式] [{lineId}] TrySkipLine结果: {skipResult}");
|
|
|
|
EnumEventSystem.Global.Send(DialogEventEnum.LineShown);
|
|
Debug.Log($"[快速模式] [{lineId}] LineShown事件已发送");
|
|
|
|
DialogCanvasManager.Instance.NextStep();
|
|
Debug.Log($"[快速模式] [{lineId}] NextStep已调用");
|
|
Debug.Log($"[快速模式] [{lineId}] ===== 快速处理完成 =====");
|
|
}
|
|
else
|
|
{
|
|
Debug.Log($"[正常模式] [{lineId}] 等待用户交互");
|
|
}
|
|
|
|
Debug.Log($"[对话流程] [{lineId}] ===== 处理完成 =====");
|
|
}
|
|
|
|
private void HandleLineOutput(LocalizedLine dialogueLine, Action onDialogueLineFinished)
|
|
{
|
|
string lineId = dialogueLine.TextID;
|
|
Debug.Log($"[文本显示] [{lineId}] 开始显示文本");
|
|
DialogCanvasManager.Instance.ShowLine(dialogueLine.TextWithoutCharacterName.Text,
|
|
dialogueLine.GetCharacterVo(), onDialogueLineFinished, dialogueLine.TextID, dialogueLine.IsAutoSkipLine());
|
|
}
|
|
|
|
public override void RunOptions(DialogueOption[] dialogueOptions, Action<int> onOptionSelected)
|
|
{
|
|
Debug.Log($"[选项显示] ===== 显示 {dialogueOptions.Length} 个选项 =====");
|
|
EnumEventSystem.Global.Send(DialogEventEnum.OptionShow);
|
|
var options = DialogOption.GeneOptions(dialogueOptions, onOptionSelected);
|
|
DialogCanvasManager.Instance.ShowOptions(options);
|
|
}
|
|
}
|
|
} |