/// <summary>
        /// 从对象池中取出T对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="maxcount"></param>
        /// <returns></returns>
        public T NewClassObjectFromPool <T>(int maxcount) where T : class, new()
        {
            ClassObjectPool <T> pool = GetOrCreateClassPool <T>(maxcount);

            if (pool == null)
            {
                return(null);
            }
            return(pool.Spawn(true));
        }
        public void Init(Transform recycleTrs, Transform sceneTrs)
        {
            ZLogger.Info("对象池管理层初始化");
            m_ResourceObjClassPool = GetOrCreateClassPool <ResourceObj>(1000);
            RecyclePoolTrs         = recycleTrs;
            RecyclePoolTrs.gameObject.SetActive(false);
            SceneTrs = sceneTrs;

            EventMgr.Instance.AddEventListener(SceneConst.SWITCH_SCENE_STAR_LOAD, ClearCache);
        }
        /// <summary>
        /// 创建类对象池,创建完成以后外面可以保存ClassObjectPool<T>,然后调用Spawn和Recycle来创建和回收对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="maxcount"></param>
        /// <returns></returns>
        public ClassObjectPool <T> GetOrCreateClassPool <T>(int maxcount) where T : class, new()
        {
            Type   type   = typeof(T);
            object outObj = null;

            if (!m_ClassPoolDic.TryGetValue(type, out outObj) || outObj == null)
            {
                ClassObjectPool <T> newPool = new ClassObjectPool <T>(maxcount);
                m_ClassPoolDic.Add(type, newPool);
                return(newPool);
            }
            return(outObj as ClassObjectPool <T>);
        }