Beispiel #1
0
 public void DisposeAllAsset(string scenesName)
 {
     if (m_DicAllScenes.ContainsKey(scenesName))
     {
         MultiABMgr multObj = m_DicAllScenes[scenesName];
         multObj.DisposeAllAsset();
     }
     else
     {
         Debug.LogError(GetType() + "/DisposeAllAsset()/找不到场景名称,无法释放资源,请检查! scenesName = " + scenesName);
     }
 }
Beispiel #2
0
        public bool IsABPackLoaded(string abName)
        {
            string[] pack      = abName.Split('/');
            string   sceneName = pack[0];

            if (m_DicAllScenes.ContainsKey(sceneName))
            {
                MultiABMgr tmpMultiMgrObj = m_DicAllScenes[sceneName];
                return(tmpMultiMgrObj.IsAssetBundlerLoaded(abName));
            }
            return(false);
        }
Beispiel #3
0
        }//Method_end

        /// <summary>
        /// 加载(AB包中)资源
        /// </summary>
        /// <param name="scenesName">场景名称</param>
        /// <param name="abName">AssetBundle包名称</param>
        /// <param name="assetName">资源名称</param>
        /// <param name="isCache">是否使用(资源)缓存</param>
        /// <returns></returns>
        public UnityEngine.Object LoadAsset(string scenesName, string abName, string assetName, bool isCache)
        {
            if (_DicAllScenes.ContainsKey(scenesName))
            {
                MultiABMgr multObj = _DicAllScenes[scenesName];
                return(multObj.LoadAsset(abName, assetName));
            }

            Debug.LogError(GetType() + "/LoadAsset()/找不到场景名称,无法加载(AB包中)资源,请检查! scenesName = " + scenesName);

            return(null);
        }
Beispiel #4
0
        IEnumerator LoadAssetBundlePack(string abName)
        {
            string[] pack      = abName.Split('/');
            string   sceneName = pack[0];

            if (!m_DicAllScenes.ContainsKey(sceneName))
            {
                MultiABMgr multiMgrObj = new MultiABMgr(sceneName, abName);
                m_DicAllScenes.Add(sceneName, multiMgrObj);
            }

            yield return(m_DicAllScenes[sceneName].LoadAssetBundle(abName));
        }
Beispiel #5
0
        /// <summary>
        /// 下载AssetBundle 指定包
        /// </summary>
        /// <param name="scenesName">场景名称</param>
        /// <param name="abName">AssetBundle 包名称</param>
        /// <param name="loadCompleteHandle">委托: 调用是否完成</param>
        /// <returns></returns>
        public IEnumerator LoadAssetBundlePack(string scenesName, string abName, Action loadCompleteHandle)
        {
            //参数检查
            if (string.IsNullOrEmpty(scenesName) || string.IsNullOrEmpty(abName))
            {
                Debug.LogError(GetType() + "/LoadAssetBundlePack()/ScenesName Or abName is null !, 请检查");
                yield return(null);
            }

            //等待Manifest清单文件加载完成
            while (!ABManifestLoader.GetInstance().IsLoadFinish)
            {
                yield return(null);
            }
            _ManifestObj = ABManifestLoader.GetInstance().GetABManifest();

            if (_ManifestObj == null)
            {
                Debug.LogError(GetType() + "/LoadAssetBundlePack()/_ManifestObj is null !, 请检查");
                yield return(null);
            }

            //把当前场景加入集合中
            if (!_DicAllScenes.ContainsKey(scenesName))
            {
                MultiABMgr multiMgrObj = new MultiABMgr(scenesName, abName);
                _DicAllScenes.Add(scenesName, multiMgrObj);
            }

            //调用下一层("多包管理类")
            MultiABMgr tmpMultiMgrObj = _DicAllScenes[scenesName];

            if (tmpMultiMgrObj == null)
            {
                Debug.LogError(GetType() + "/LoadAssetBundlePack()/tmpMultiMgrObj is null !, 请检查");
            }

            //调用 "多包管理类" 的加载指定AB包。
            yield return(tmpMultiMgrObj.LoadAssetBundler(abName, loadCompleteHandle));
        }//Method_end