77 lines
1.7 KiB
C#
77 lines
1.7 KiB
C#
|
|
using System;
|
||
|
|
using System.Runtime.CompilerServices;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace QFramework
|
||
|
|
{
|
||
|
|
internal class StrEventAction : IAction
|
||
|
|
{
|
||
|
|
public string txt;
|
||
|
|
|
||
|
|
|
||
|
|
public System.Action OnFinished { get; set; }
|
||
|
|
|
||
|
|
|
||
|
|
private StrEventAction()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private static readonly SimpleObjectPool<StrEventAction> mPool =
|
||
|
|
new SimpleObjectPool<StrEventAction>(() => new StrEventAction(), null, 10);
|
||
|
|
|
||
|
|
string key = string.Empty;
|
||
|
|
string arg = string.Empty;
|
||
|
|
public static StrEventAction Allocate(string key, string arg, System.Action OnFinished = null)
|
||
|
|
{
|
||
|
|
var retNode = mPool.Allocate();
|
||
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
||
|
|
retNode.Deinited = false;
|
||
|
|
retNode.Reset();
|
||
|
|
retNode.OnFinished = OnFinished;
|
||
|
|
retNode.key = key;
|
||
|
|
retNode.arg = arg;
|
||
|
|
return retNode;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public ulong ActionID { get; set; }
|
||
|
|
public ActionStatus Status { get; set; }
|
||
|
|
|
||
|
|
public void OnStart()
|
||
|
|
{
|
||
|
|
StringEventSystem.Global.Send(key, arg.Split(","));
|
||
|
|
this.Finish();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnExecute(float dt)
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnFinish()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Reset()
|
||
|
|
{
|
||
|
|
Status = ActionStatus.NotStart;
|
||
|
|
Paused = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool Paused { get; set; }
|
||
|
|
|
||
|
|
public void Deinit()
|
||
|
|
{
|
||
|
|
if (!Deinited)
|
||
|
|
{
|
||
|
|
OnFinished = null;
|
||
|
|
Deinited = true;
|
||
|
|
mPool.Recycle(this);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool Deinited { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|