using System.Collections; using System.Collections.Generic; using UnityEngine; using QFramework; using System; using QFramework.Example; using System.Linq; public class TipWindowAction : 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 TipWindowAction(), null, 10); string text = string.Empty; Dictionary datas; public static TipWindowAction Allocate(string text, Dictionary datas, System.Action onDelayFinish = null) { var retNode = mPool.Allocate(); retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.Deinited = false; retNode.Reset(); retNode.text = text; 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() { UITipWindowData data = new UITipWindowData(); data.txt = text; var btnText = datas.ContainsKey("btns") ? datas["btns"].Split(',').ToList() : null; if (btnText != null) { foreach (var item in btnText) { data.btns.Add(new UITipWindowData.ItemData() { txt = item }); } } data.audio = datas.ContainsKey("audio") ? datas["audio"] : null; data.ExportVideoPath = datas.ContainsKey("exportVideoPath") ? datas["exportVideoPath"] : null; UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish()); } public void Reset() { Status = ActionStatus.NotStart; Paused = false; } }