using FairyGUI; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GFGGame { public static class EffectUIPool { private static List effectUIs = new List(); public static EffectUI CreateEffectUI(GGraph holder, string uiName, string resName, float scale = 100) { EffectUI effectUI; if (effectUIs.Count > 0) { int lastIndex = effectUIs.Count - 1; effectUI = effectUIs[lastIndex]; effectUIs.RemoveAt(lastIndex); } else { effectUI = new EffectUI(); } effectUI.Reset(holder, uiName, resName, scale); return effectUI; } public static void Recycle(EffectUI effect) { if (effect == null) return; effect.Dispose(); if (effectUIs.Contains(effect)) return; effectUIs.Add(effect); } } }