Exemplo n.º 1
0
        public void Init(EResMgrType type, string assetRoot = null)
        {
            switch (type)
            {
            case EResMgrType.ASSET_BUNDLE:
                Debug.Log(Log.Zero1("初始化资源管理器... 资源来源:[AssetBundle]  Manifest路径:{0}", assetRoot));
                var newMgr = new AssetBundleResMgr(assetRoot);
                if (_mgr != null && _mgr is AssetBundleResMgr)
                {
                    //替换旧的需要继承一下已加载字典
                    newMgr.Inherit(_mgr as AssetBundleResMgr);
                }
                _mgr = newMgr;
                break;

            case EResMgrType.RESOURCES:
                Debug.Log(Log.Zero1("初始化资源管理器... 资源来源:[Resources]"));
                _mgr = new ResourcesResMgr();
                break;

            case EResMgrType.ASSET_DATA_BASE:
                Debug.Log(Log.Zero1("初始化资源管理器... 资源来源:[AssetDataBase] 资源根目录:{0}", assetRoot));
                _mgr = new AssetDataBaseResMgr(assetRoot);
                break;
            }
        }
 /// <summary>
 /// 让已加载的AB资源字典继承源资源管理器
 /// </summary>
 /// <param name="source"></param>
 internal void Inherit(AssetBundleResMgr source)
 {
     _loadedABDic = source._loadedABDic;
 }