Esempio n. 1
0
        /// <summary>
        /// 加载主资源
        /// </summary>
        /// <param name="assetCategory">资源分类</param>
        /// <param name="assetFullName">资源路径</param>
        /// <param name="onComplete"></param>
        public void LoadMainAsset(AssetCategory assetCategory, string assetFullName, BaseAction <ResourceEntity> onComplete = null)
        {
            MainAssetLoaderRoutine routine = GameEntry.Pool.DequeueClassObject <MainAssetLoaderRoutine>();

            routine.Load(assetCategory, assetFullName, (ResourceEntity resEntity) =>
            {
                if (onComplete != null)
                {
                    onComplete(resEntity);
                }
            });
        }
        /// <summary>
        /// 加载依赖资源
        /// </summary>
        private void LoadDependsAsset()
        {
            List <AssetDependsEntity> lst = m_CurrAssetEntity.DependsAssetList;

            if (lst != null)
            {
                int len = lst.Count;
                m_NeedLoadAssetDependCount = len;
                for (int i = 0; i < len; i++)
                {
                    AssetDependsEntity     entity  = lst[i];
                    MainAssetLoaderRoutine routine = GameEntry.Pool.DequeueClassObject <MainAssetLoaderRoutine>();
                    routine.Load(entity.Category, entity.AssetFullName, OnLoadDependsAssetComplete);
                }
            }
            else
            {
                //这个资源没有依赖 直接加载主资源
                LoadMainAsset();
            }
        }