41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using GameFramework;
|
|
using GameFramework.Event;
|
|
|
|
namespace SepCore.Event
|
|
{
|
|
public class DialogEventArgs : GameEventArgs
|
|
{
|
|
public static readonly int EventId = typeof(DialogEventArgs).GetHashCode();
|
|
|
|
public override int Id => EventId;
|
|
|
|
public int ButtonId { get; private set; }
|
|
|
|
public object UserData { get; private set; }
|
|
|
|
/// <summary>
|
|
/// 创建 DialogEventArgs 事件示例
|
|
/// </summary>
|
|
/// <param name="buttonId">
|
|
/// <list type="buttet">
|
|
/// <item>1 为 ConfirmButton</item>
|
|
/// <item>2 为 CancelButton</item>
|
|
/// <item>3 为 OtherButton</item>
|
|
/// </list>
|
|
/// </param>
|
|
/// <param name="userData">用户自定义数据</param>
|
|
/// <returns></returns>
|
|
public static DialogEventArgs Create(int buttonId, object userData)
|
|
{
|
|
DialogEventArgs dialogEventArgs = ReferencePool.Acquire<DialogEventArgs>();
|
|
dialogEventArgs.ButtonId = buttonId;
|
|
dialogEventArgs.UserData = userData;
|
|
return dialogEventArgs;
|
|
}
|
|
|
|
public override void Clear()
|
|
{
|
|
UserData = null;
|
|
}
|
|
}
|
|
} |