63 lines
1.5 KiB
C#
63 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using QFramework;
|
|
using System;
|
|
using QFramework.Example;
|
|
public class BtnsAction : 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<BtnsAction> mPool =
|
|
new SimpleObjectPool<BtnsAction>(() => new BtnsAction(), null, 10);
|
|
string btnStr = string.Empty;
|
|
public static BtnsAction Allocate(string btnStr, System.Action onDelayFinish = null)
|
|
{
|
|
var retNode = mPool.Allocate();
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
|
retNode.Deinited = false;
|
|
retNode.Reset();
|
|
retNode.btnStr = btnStr;
|
|
return retNode;
|
|
}
|
|
|
|
|
|
|
|
public void Deinit()
|
|
{
|
|
if (!Deinited)
|
|
{
|
|
Deinited = true;
|
|
mPool.Recycle(this);
|
|
}
|
|
}
|
|
|
|
public void OnExecute(float dt)
|
|
{
|
|
}
|
|
|
|
public void OnFinish()
|
|
{
|
|
}
|
|
|
|
public void OnStart()
|
|
{
|
|
UIBtnsData data = new UIBtnsData();
|
|
var btns = btnStr.Split(',');
|
|
foreach (var item in btns)
|
|
{
|
|
data.btns.Add(item);
|
|
}
|
|
UIKit.OpenPanelAsync<UIBtns>(uiData: data, canvasLevel: UILevel.RightBottom).ToAction().StartGlobal(() => this.Finish());
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
Status = ActionStatus.NotStart;
|
|
Paused = false;
|
|
}
|
|
}
|