public IABLoader(LoadProgess prog, LoadFinished loadFinish) { commonBundlePath = ""; bundleName = ""; loadProgess = prog; loadFinished = loadFinish; iABResLoad = null; }
//释放功能 public void Dispose() { if (iABResLoad != null) { iABResLoad.Dispose(); iABResLoad = null; } }
/// <summary> /// 协程加载 /// </summary> /// <returns>The laod.</returns> public IEnumerator CommonLaod() { comWWW = new WWW(commonBundlePath); while (!comWWW.isDone) { progress = comWWW.progress; if (loadProgess != null) { loadProgess(bundleName, progress); } yield return(comWWW.progress); progress = comWWW.progress; } if (progress >= 1.0)//表示加载完成 { iABResLoad = new IABResLoad(comWWW.assetBundle); if (loadProgess != null) { loadProgess(bundleName, progress); } if (loadFinished != null) { this.loadFinished(bundleName); // Debug.Log("loadFinished"); } // Debug.Log("CommonLaod"); } else { Debug.LogError("load bundle error " + bundleName); } comWWW = null; }