public ClassObjectPool <T> GetOrCreateClassPool <T>(int capacity) where T : class, new() { Type type = typeof(T); object outObj; if (!classPoolDic.TryGetValue(type, out outObj) || outObj == null) { ClassObjectPool <T> newPool = new ClassObjectPool <T>(capacity); classPoolDic.Add(typeof(T), newPool); outObj = newPool; } return(outObj as ClassObjectPool <T>); }
public void Init(Transform transRecylePool, Transform sceneTrans) { objectItemNativePool = GetOrCreateClassPool <ObjectItem>(Capacity.ObjectItem); RecylePoolTrans = transRecylePool; SceneTrans = sceneTrans; }