using System.Collections; using System.Collections.Generic; using UnityEngine; using QFramework; using System; using QFramework.Example; public class UIShowAction : 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 mPool = new SimpleObjectPool(() => new UIShowAction(), null, 10); string uiName = string.Empty; bool isShow = true; public static UIShowAction Allocate(string uiName, string isShow = "true", System.Action onDelayFinish = null) { var retNode = mPool.Allocate(); retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.Deinited = false; retNode.Reset(); retNode.uiName = uiName; bool.TryParse(isShow, out retNode.isShow); return retNode; } public void Deinit() { if (!Deinited) { Deinited = true; mPool.Recycle(this); } } public void OnExecute(float dt) { } public void OnFinish() { } public void OnStart() { if (isShow) { UIKit.OpenPanelAsync(ActionHelper.typeDict[uiName], assetBundleName: uiName).ToAction().StartGlobal(() => this.Finish()); } else { UIKit.HidePanel(ActionHelper.typeDict[uiName]); this.Finish(); } } public void Reset() { Status = ActionStatus.NotStart; Paused = false; } }