80 lines
2.0 KiB
C#
80 lines
2.0 KiB
C#
using QFramework.Example;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
namespace QFramework
|
|
{
|
|
|
|
public class TimeOutAction : IAction
|
|
{
|
|
public ulong ActionID
|
|
{
|
|
get; set;
|
|
}
|
|
public bool Deinited
|
|
{
|
|
get; set;
|
|
}
|
|
public bool Paused
|
|
{
|
|
get; set;
|
|
}
|
|
public ActionStatus Status
|
|
{
|
|
get; set;
|
|
}
|
|
|
|
private static readonly SimpleObjectPool<TimeOutAction> mPool =
|
|
new SimpleObjectPool<TimeOutAction>(() => new TimeOutAction(), null, 10);
|
|
string text = string.Empty;
|
|
Dictionary<string, string> datas;
|
|
public static TimeOutAction Allocate( Dictionary<string, string> datas, System.Action onDelayFinish = null)
|
|
{
|
|
var retNode = mPool.Allocate();
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
|
retNode.Deinited = false;
|
|
retNode.Reset();
|
|
retNode.datas = datas;
|
|
return retNode;
|
|
}
|
|
|
|
|
|
|
|
public void Deinit()
|
|
{
|
|
if (!Deinited)
|
|
{
|
|
Deinited = true;
|
|
mPool.Recycle(this);
|
|
}
|
|
}
|
|
|
|
public void OnExecute(float dt)
|
|
{
|
|
}
|
|
|
|
public void OnFinish()
|
|
{
|
|
}
|
|
|
|
public void OnStart()
|
|
{
|
|
UITimeOutData data = new UITimeOutData();
|
|
|
|
data.totalTimeStr = datas.ContainsKey("TimeStr") ? datas["TimeStr"] : string.Empty;
|
|
data.varName = datas.ContainsKey("var") ? datas["var"] : string.Empty;
|
|
data.varValue = datas.ContainsKey("varValue") ? datas["varValue"] : string.Empty;
|
|
|
|
|
|
|
|
UIKit.OpenPanelAsync<UITimeOut>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
Status = ActionStatus.NotStart;
|
|
Paused = false;
|
|
}
|
|
}
|
|
} |