コード例 #1
0
        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>);
        }
コード例 #2
0
 public void Init(Transform transRecylePool, Transform sceneTrans)
 {
     objectItemNativePool = GetOrCreateClassPool <ObjectItem>(Capacity.ObjectItem);
     RecylePoolTrans      = transRecylePool;
     SceneTrans           = sceneTrans;
 }