Exemple #1
0
        public GameObject Spawn(EABType resType, string goName)
        {
            GameObject     tmpGo     = null;
            GameObjectPool tmpGoPool = null;

            if (mABType2GoPoolDict.TryGetValue(resType, out tmpGoPool))
            {
                tmpGo = tmpGoPool.Spawn(goName);
            }

            return(tmpGo);
        }
Exemple #2
0
        public void Despawn(EABType resType, string goName, GameObject go)
        {
            GameObjectPool tmpGoPool = null;

            if (!mABType2GoPoolDict.TryGetValue(resType, out tmpGoPool))
            {
                GameObject tmpGo = new GameObject(resType.ToString());
                tmpGo.transform.SetParent(mRootGo.transform, false);
                tmpGoPool = new GameObjectPool(tmpGo);
                mABType2GoPoolDict.Add(resType, tmpGoPool);
            }

            tmpGoPool.Despawn(goName, go);
        }
Exemple #3
0
        public void ClearByType(EABType eABType)
        {
            GameObjectPool tmpGoPool = null;

            if (mABType2GoPoolDict.TryGetValue(eABType, out tmpGoPool))
            {
                tmpGoPool.Clear((name, count) =>
                {
                    for (int i = 0; i < count; ++i)
                    {
                        mResMgr.UnLoadBundleByType(eABType, name);
                    }
                });

                mABType2GoPoolDict.Remove(eABType);
            }
        }