private void Awake() { DontDestroyOnLoad(this); m_DicMultiABMgr = new Dictionary <string, MultiABMgr>(); StartCoroutine(ABManifestLoader.GetInstance().LoadABManifestFile()); }
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 static ABManifestLoader GetInstance() { if (m_Instance == null) { m_Instance = new ABManifestLoader(); } return(m_Instance); }
public IEnumerator LoadAssetbundle(string abName) { if (string.IsNullOrEmpty(abName)) { Debug.LogError(GetType() + "/LoadAssetbundle()/参数abName不能为空,请检查!"); yield break; } if (m_DicSingleABLoaderCache.ContainsKey(abName)) { Debug.LogWarning(GetType() + "/LoadAssetbundle()/该ab包已经加载!"); if (this.m_DelAllABLoadComplete != null) { this.m_DelAllABLoadComplete(abName); } yield break; } if (!m_DicABRelation.ContainsKey(abName)) { ABRelation tmpABRelation = new ABRelation(abName); m_DicABRelation.Add(abName, tmpABRelation); } ABRelation m_ABRelation = m_DicABRelation[abName]; string[] ABDependences = ABManifestLoader.GetInstance().RetervalABDependen(abName); foreach (string ABDependence in ABDependences) { m_ABRelation.AddABDependence(ABDependence); yield return(LoadABReference(ABDependence, abName)); } if (!m_DicSingleABLoaderCache.ContainsKey(abName)) { SingleABLoader tmpSingleABLoader = new SingleABLoader(abName, OnLoadAllABComplete); m_DicSingleABLoaderCache.Add(abName, tmpSingleABLoader); } SingleABLoader m_SingleABLoader = m_DicSingleABLoaderCache[abName]; yield return(m_SingleABLoader.LoadSingleAB()); }