/// <summary> /// 安卓解包过程 /// </summary> private IEnumerator StartAndroidUnPack(AssetBundleDownloadTaskModel taskModel, Action onComplete) { string resDicUrl = ABDataConfig.AppAssetBundleDirName; //安卓包资源路径 string targetDicUrl = ABDataConfig.localABFullName; //目标路径 string[] copyFile = new string[] { ABDataConfig.localCacheFileName, ABDataConfig.localDepFileName, }; //先拷贝cache.txt 与dep.file文件 taskModel.taskMessage = "解压配置文件"; yield return(CopyAssetBundle(resDicUrl, targetDicUrl, copyFile)); //解析dep文件 得到所有的ab 名字 var abNames = AssetBundleDepFileManager.ResolveDepFile(targetDicUrl + copyFile[1]); //添加mainfest文件 int count = abNames.Count; for (int i = 0; i < count; ++i) { abNames.Add(abNames[i] + ABDataConfig.assetBundleManifestFilePostfixName); } //在拷贝所有ab文件 taskModel.taskMessage = "解压ab文件"; yield return(CopyAssetBundle(resDicUrl, targetDicUrl, abNames)); DebugManager.Log("解包完成!"); taskModel.taskMessage = "解包完成"; yield return(0); onComplete(); }
/// <summary> /// 结束ab资源更新(注意:必须在ab资源全部更新完成后才能调用!) /// </summary> public void ExitUpdateAssetBundle() { //保存cache文件 AssetBundleCacheFileManager.Instance.SaveCacheFileOfAssetBundleDownloadOk(); //卸载dep manager AssetBundleDepFileManager.DestroyInstance(); //卸载cache mananer AssetBundleCacheFileManager.DestroyInstance(); //卸载abdownload manager AssetBundleDownloadManager.DestroyInstance(); DebugManager.LogWarning("ab下载器卸载成功!"); }