自动跳过和判断是否在对话的逻辑
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Yarn.Unity;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class LineView : DialogueViewBase
|
||||
{
|
||||
private const string AutoNext = "auto_next";
|
||||
|
||||
// 进入指令选项模式
|
||||
private bool _isInCommand;
|
||||
|
||||
@@ -18,9 +21,8 @@ namespace AibisDream
|
||||
base.RunLine(dialogueLine, onDialogueLineFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
DialogUiViewer.Instance.ShowLine(dialogueLine.TextWithoutCharacterName.Text,
|
||||
dialogueLine.CharacterName, onDialogueLineFinished);
|
||||
|
||||
HandleLineOutput(dialogueLine, onDialogueLineFinished);
|
||||
|
||||
if (DialogController.Instance.quickRunMode)
|
||||
{
|
||||
@@ -28,6 +30,26 @@ namespace AibisDream
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleLineOutput(LocalizedLine dialogueLine, Action onDialogueLineFinished)
|
||||
{
|
||||
// 对话系统正在交谈状态
|
||||
DialogController.Instance.IsTalking = true;
|
||||
|
||||
// 解析LocalizedLine
|
||||
if (dialogueLine.Metadata != null && dialogueLine.Metadata.Contains(AutoNext))
|
||||
{
|
||||
// 自动跳过
|
||||
DialogUiViewer.Instance.ShowAutoLine(dialogueLine.TextWithoutCharacterName.Text,
|
||||
dialogueLine.CharacterName, onDialogueLineFinished);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 需要玩家点击
|
||||
DialogUiViewer.Instance.ShowLine(dialogueLine.TextWithoutCharacterName.Text,
|
||||
dialogueLine.CharacterName, onDialogueLineFinished);
|
||||
}
|
||||
}
|
||||
|
||||
public override void RunOptions(DialogueOption[] dialogueOptions, Action<int> onOptionSelected)
|
||||
{
|
||||
if (_isInCommand)
|
||||
@@ -37,6 +59,7 @@ namespace AibisDream
|
||||
return;
|
||||
}
|
||||
|
||||
DialogController.Instance.IsTalking = true;
|
||||
DialogUiViewer.Instance.ShowOptions(dialogueOptions, onOptionSelected);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user