73 lines
1.5 KiB
C#
73 lines
1.5 KiB
C#
|
|
using System;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace QFramework
|
||
|
|
{
|
||
|
|
internal class LogAction : IAction
|
||
|
|
{
|
||
|
|
public string txt;
|
||
|
|
|
||
|
|
|
||
|
|
public System.Action OnFinished { get; set; }
|
||
|
|
|
||
|
|
|
||
|
|
private LogAction()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private static readonly SimpleObjectPool<LogAction> mPool =
|
||
|
|
new SimpleObjectPool<LogAction>(() => new LogAction(), null, 10);
|
||
|
|
|
||
|
|
public static LogAction Allocate(string txt, System.Action OnFinished = null)
|
||
|
|
{
|
||
|
|
var retNode = mPool.Allocate();
|
||
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
||
|
|
retNode.Deinited = false;
|
||
|
|
retNode.txt = txt;
|
||
|
|
retNode.Reset();
|
||
|
|
retNode.OnFinished = OnFinished;
|
||
|
|
return retNode;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public ulong ActionID { get; set; }
|
||
|
|
public ActionStatus Status { get; set; }
|
||
|
|
|
||
|
|
public void OnStart()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnExecute(float dt)
|
||
|
|
{
|
||
|
|
Debug.LogError(txt);
|
||
|
|
this.Finish();
|
||
|
|
OnFinished?.Invoke();
|
||
|
|
}
|
||
|
|
|
||
|
|
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; }
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|