public void ReleaseObject(string res, GameObject gameObject, EPoolObjectType type) { if (objectsPool == null) { objectsPool = new GameObject("ObjectPool"); // objectsPool.AddComponent<UIP objectsPool.transform.localPosition = new Vector3(0, -5000, 0); } if (null == res || null == gameObject) { return; } ObjectPool pool = null; if (!mPoolDic.TryGetValue(res, out pool)) { pool = new ObjectPool(); mPoolDic.Add(res, pool); } PoolObjectInfo poolObjectInfo = new PoolObjectInfo(); poolObjectInfo.type = type; poolObjectInfo.mName = res; DisablePoolObject(gameObject, poolObjectInfo); pool.mContainer[gameObject] = poolObjectInfo; }
public void ReleaseGo(string path, GameObject go, EPoolObjectType type) { if (string.IsNullOrEmpty(path) || go == null) { return; } if (mObjectsPool == null) { mObjectsPool = new GameObject("PoolManager"); mObjectsPool.transform.localPosition = new Vector3(0, -10000, 0); } go.transform.parent = mObjectsPool.transform; PoolInfo poolInfo = null; if (!mPoolDict.TryGetValue(path, out poolInfo)) { poolInfo = new PoolInfo(); mPoolDict.Add(path, poolInfo); } XPoolObj obj = new XPoolObj(); obj.type = type; obj.name = path; obj.gameObject = go; DisablePoolGameObject(go, obj); poolInfo.quene.Enqueue(obj); }
public PoolableObject(EPoolObjectType key, GameObject gameObject) { m_key = key; m_poolableObject = gameObject; }