59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Yarn.Unity;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class LineView : DialogueViewBase
|
|
{
|
|
// 进入指令选项模式
|
|
private bool isInCommand;
|
|
|
|
public override void RunLine(LocalizedLine dialogueLine, Action onDialogueLineFinished)
|
|
{
|
|
isInCommand = dialogueLine.Text.HasCommandAttr();
|
|
|
|
if (isInCommand)
|
|
{
|
|
DialogUiViewer.Instance.HideDialog();
|
|
base.RunLine(dialogueLine, onDialogueLineFinished);
|
|
return;
|
|
}
|
|
|
|
DialogUiViewer.Instance.ShowLine(dialogueLine.TextWithoutCharacterName.Text,
|
|
dialogueLine.CharacterName, onDialogueLineFinished);
|
|
}
|
|
|
|
public override void RunOptions(DialogueOption[] dialogueOptions, Action<int> onOptionSelected)
|
|
{
|
|
if (isInCommand)
|
|
{
|
|
DialogUiViewer.Instance.HideDialog();
|
|
base.RunOptions(dialogueOptions, onOptionSelected);
|
|
return;
|
|
}
|
|
|
|
DialogUiViewer.Instance.ShowOptions(dialogueOptions, onOptionSelected);
|
|
}
|
|
|
|
public override void InterruptLine(LocalizedLine dialogueLine, Action onDialogueLineFinished)
|
|
{
|
|
base.InterruptLine(dialogueLine, onDialogueLineFinished);
|
|
}
|
|
|
|
public override void DismissLine(Action onDismissalComplete)
|
|
{
|
|
base.DismissLine(onDismissalComplete);
|
|
}
|
|
|
|
public override void UserRequestedViewAdvancement()
|
|
{
|
|
Debug.Log("Break");
|
|
requestInterrupt.Invoke();
|
|
}
|
|
}
|
|
}
|
|
|