public void DisposeAllAsset() { try { foreach (SingleABLoader item_SingleABLoader in m_DicSingleABLoaderCache.Values) { item_SingleABLoader.DisposeAll(); } } catch (Exception e) { Debug.LogError(e.ToString()); } finally { m_DicSingleABLoaderCache.Clear(); m_DicSingleABLoaderCache = null; m_DicABRelation.Clear(); m_DicABRelation = null; m_DelAllABLoadComplete = null; currentSceneName = null; abName = null; Resources.UnloadUnusedAssets(); GC.Collect(); } }
private IEnumerator LoadAssetBundle(string sceneName, string abName, DelABLoadComplete loadAllComplete) { if (string.IsNullOrEmpty(sceneName) || string.IsNullOrEmpty(abName)) { Debug.LogError(GetType() + "/LoadAssetBundlePack()/参数sceneName或abName不能为空!"); yield break; } while (!ABManifestLoader.GetInstance().IsFinishLoad) { yield return(null); } m_ABManifestObj = ABManifestLoader.GetInstance().GetABManifest(); if (m_ABManifestObj == null) { Debug.LogError(GetType() + "/LoadAssetBundlePack()/字段m_ABManifestObj不能为空,请检查清单文件类是否加载成功!"); yield break; } if (!m_DicMultiABMgr.ContainsKey(sceneName)) { MultiABMgr tmpMultiABMgr = new MultiABMgr(sceneName, abName, loadAllComplete); m_DicMultiABMgr.Add(sceneName, tmpMultiABMgr); } MultiABMgr MultiABMgrObj = m_DicMultiABMgr[sceneName]; if (MultiABMgrObj == null) { Debug.LogError(GetType() + "/LoadAssetBundlePack()/字段MultiABMgrObj不能为空!"); yield break; } yield return(MultiABMgrObj.LoadAssetbundle(abName)); }
public SingleABLoader(string ABName, DelABLoadComplete m_DelABLoadComplete) { if (ABName == null) { Debug.LogError(GetType() + "/构造函数/参数ABName为null,请检查!"); return; } this.m_ABName = ABName; this.m_ABDownloadPath = PathTools.GetABWWWDownloadPath() + "/" + this.m_ABName; this.m_DelABLoadComplete = m_DelABLoadComplete; //Debug.Log(this.m_ABDownloadPath); }
public MultiABMgr(string sceneName, string ABName, DelABLoadComplete OnLoadAllABComplete) { if (string.IsNullOrEmpty(sceneName) || string.IsNullOrEmpty(ABName)) { Debug.LogError(GetType() + "/构造函数/参数sceneName或ABName不能为空,请检查!"); return; } this.currentSceneName = sceneName; this.abName = ABName; this.m_DelAllABLoadComplete = OnLoadAllABComplete; m_DicSingleABLoaderCache = new Dictionary <string, SingleABLoader>(); m_DicABRelation = new Dictionary <string, ABRelation>(); }
public void LoadAssetBundlePack(string sceneName, string abName, DelABLoadComplete loadAllComplete) { StartCoroutine(LoadAssetBundle(sceneName, abName, loadAllComplete)); }