64 lines
1.5 KiB
C#
64 lines
1.5 KiB
C#
using AibisDream.Kit;
|
||
using AibisDream.Utility;
|
||
using Yarn.Unity;
|
||
|
||
namespace AibisDream
|
||
{
|
||
public enum EventEnum
|
||
{
|
||
NextYarn,
|
||
DialogOption,
|
||
PlugIn,
|
||
PlugOut
|
||
}
|
||
|
||
public enum DialogEventEnum
|
||
{
|
||
LineStart,
|
||
OptionShow,
|
||
OptionSelected,
|
||
LineShowed,
|
||
LineEnd,
|
||
Command
|
||
}
|
||
|
||
public struct DialogLine
|
||
{
|
||
public bool isOption;
|
||
public string line;
|
||
public CharacterVo actor;
|
||
public string lineId;
|
||
|
||
/// <summary>
|
||
/// 获取进行记录的对话
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public string GetDialogText()
|
||
{
|
||
// 先去掉换行
|
||
var realLine = line.Replace("<br>", "");
|
||
|
||
if (!isOption)
|
||
{
|
||
return string.IsNullOrEmpty(actor.GetActorName())
|
||
? realLine + "<br>"
|
||
: actor.GetActorName() + ":" + realLine + "<br>";
|
||
}
|
||
else
|
||
{
|
||
return "-> " + realLine + "<br>";
|
||
}
|
||
}
|
||
|
||
public static DialogLine GetLine(LocalizedLine dialogueLine)
|
||
{
|
||
return new DialogLine()
|
||
{
|
||
isOption = false,
|
||
line = dialogueLine.TextWithoutCharacterName.Text,
|
||
lineId = dialogueLine.TextID,
|
||
actor = dialogueLine.GetCharacterVo()
|
||
};
|
||
}
|
||
}
|
||
} |