public static void AsyncGet(string path, Action <GameObject> cb) { GameObjectCeil ceil = GetFromPool(path); Action <GameObjectCeil> go = (obj) => { if (obj = null) { return; } CreatDict(path); ceil.SetBeingUse(true); m_using[path].Add(ceil); cb?.Invoke(obj.TheGameobject); }; if (null != ceil) { go.Invoke(ceil); } else { GetFromAysncLoad(path, go); } }
private static void BackToPool(GameObjectCeil ceil) { CreatDict(ceil.ThePath); if (!ceil.IsBeingUse) { #if UNITY_EDITOR Debug.LogError("[资产非法][资产回池异常!!][重复回池][The Asset Name:]" + ceil.ThePath); UnityEditor.EditorApplication.isPlaying = false; #endif return; } ceil.SetBeingUse(false); if (null != ceil.TheTransform) { ceil.TheTransform.parent = m_root; } if (m_using[ceil.ThePath].Contains(ceil)) { m_using[ceil.ThePath].Remove(ceil); } if (!m_idle[ceil.ThePath].Contains(ceil)) { m_idle[ceil.ThePath].Add(ceil); } }
public static GameObject Get(string path) { GameObjectCeil ceil = GetFromPool(path); if (null == ceil) { ceil = GetFromLoad(path); } if (null == ceil) { return(null); } CreatDict(path); ceil.SetBeingUse(true); m_using[path].Add(ceil); return(ceil.TheGameobject); }