Beispiel #1
0
        /// <summary>
        /// 初始化异步管理器
        /// </summary>
        /// <returns></returns>
        public bool InitAsyncManager()
        {
            //初始化异步加载资源列表
            m_asyncAssetLoadingList = new List <AsyncLoadResParam> [(int)LoadResPriority.RES_LOAD_LEVEL_COUNT];

            m_asyncLoadingAssetDic = new Dictionary <uint, AsyncLoadResParam>();

            m_asyncLoadResParamPool = new MClassObjectPool <AsyncLoadResParam>(50);

            m_asyncCallBackPool = new MClassObjectPool <AsyncCallBack>(50);

            //初始化MonoBehavior脚本
            if (m_startMono == null)
            {
                m_startMono = MGameManager.m_monoBehavior;
            }

            for (int i = 0; i < (int)LoadResPriority.RES_LOAD_LEVEL_COUNT; i++)
            {
                m_asyncAssetLoadingList[i] = new List <AsyncLoadResParam>();
            }

            //游戏初始化 需要开启这个异步加载的协程
            m_startMono.StartCoroutine(AsyncLoader());
            return(true);
        }
Beispiel #2
0
        public override bool Init()
        {
            m_assetBundleItemDic  = new Dictionary <uint, MAssetBundleItem>();
            m_assetBundleItemPool = new MClassObjectPool <MAssetBundleItem>(500);
            bool loadConfig = LoadAssetBundleConfig();

            return(base.Init());
        }
 public bool InitSyncObjectManager()
 {
     m_resourcesItemPoolDic   = new Dictionary <uint, List <MResourceObjectItem> >();
     m_resourceObjectClssPool = new MClassObjectPool <MResourceObjectItem>(100);
     m_resourceObjectDic      = new Dictionary <int, MResourceObjectItem>();
     Object.DontDestroyOnLoad(DefaultObjectTrans);
     Object.DontDestroyOnLoad(RecycleObjectPoolTrans);
     return(true);
 }
Beispiel #4
0
        /// <summary>
        /// 创建类对象池
        /// </summary>
        /// <returns>某一个类的对象池</returns>
        /// <param name="Count">类对象池的大小</param>
        public MClassObjectPool <T> GetClassPool <T>(int Count) where T : class, new()
        {
            Type   type   = typeof(T);
            object outObj = null;

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