88 lines
2.6 KiB
C#
88 lines
2.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Threading;
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
namespace Net.Project.B.Dialogue
|
|
{
|
|
/// <summary>
|
|
/// 对话数据
|
|
/// </summary>
|
|
public interface IDialogueData
|
|
{
|
|
/// <summary>
|
|
/// 唯一对话ID
|
|
/// </summary>
|
|
public int Identity { get; set; }
|
|
/// <summary>
|
|
/// 通道ID,用于区分不同的对话
|
|
/// </summary>
|
|
public int Channel { get; }
|
|
/// <summary>
|
|
/// 演员ID,谁是说话的人
|
|
/// </summary>
|
|
public int ActorIdentity { get; }
|
|
/// <summary>
|
|
/// 文本
|
|
/// </summary>
|
|
public string Text { get; }
|
|
/// <summary>
|
|
/// 语音路径
|
|
/// </summary>
|
|
public string VoicePath { get; }
|
|
/// <summary>
|
|
/// 等待对话完成
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
CancellationTokenAwaitable.Awaiter GetAwaiter();
|
|
/// <summary>
|
|
/// 跳过对话
|
|
/// </summary>
|
|
public CancellationTokenSource CancellationTokenSource { get; set; }
|
|
/// <summary>
|
|
/// 元对象
|
|
/// </summary>
|
|
public object MetaObject { get; set; }
|
|
}
|
|
/// <summary>
|
|
/// 对话选择
|
|
/// </summary>
|
|
public interface IDialogueChoice
|
|
{
|
|
/// <summary>
|
|
/// 索引
|
|
/// </summary>
|
|
public int Index { get; }
|
|
/// <summary>
|
|
/// 文本
|
|
/// </summary>
|
|
public string Text { get; }
|
|
/// <summary>
|
|
/// 是否可选
|
|
/// </summary>
|
|
public bool Enabled { get; }
|
|
/// <summary>
|
|
/// 备注,例如:选择这个选项会触发什么事件,不可选的原因等
|
|
/// </summary>
|
|
public string Remark { get; }
|
|
}
|
|
public struct DialogueData:IDialogueData
|
|
{
|
|
public int Identity { get; set; }
|
|
public int Channel { get; set; }
|
|
public int ActorIdentity { get; set; }
|
|
public string Text { get; set; }
|
|
public string VoicePath { get; set; }
|
|
public CancellationTokenAwaitable.Awaiter GetAwaiter() => CancellationTokenSource.Token.WaitUntilCanceled().GetAwaiter();
|
|
public CancellationTokenSource CancellationTokenSource { get; set; }
|
|
public object MetaObject { get; set; }
|
|
}
|
|
public struct DialogueChoice:IDialogueChoice
|
|
{
|
|
public int Index { get; set; }
|
|
public string Text { get; set; }
|
|
public bool Enabled { get; set; }
|
|
public string Remark { get; set; }
|
|
}
|
|
} |