void updateAssets(AssetVersion newAsset, System.Action <bool> whenDownloadOver = null) { if (newAsset == null || curAssetVersion == null) { Debug.LogError("newAsset or localAsset null"); if (whenDownloadOver != null) { whenDownloadOver(false); } return; } Dictionary <string, Hash128> updateList = new Dictionary <string, Hash128>(); Debug.Log("assetversion1:" + newAsset.ToStr() + "old kkkk:" + curAssetVersion.ToStr()); AssetVersion.CompareAndGetUpdateList(curAssetVersion, newAsset, out updateList); //更新总的依赖文件 loader.UpdateManifestFromServer(AssetBundleInfo.assetPath_server, (AssetBundleManifest am) => { Debug.Log("服务器更新了manifest"); AssetBundleInfo.SetManifest(am); if (updateList != null) { loader.UpdateFromServer(AssetBundleInfo.assetPath_server, updateList, whenDownloadOver); } else { if (whenDownloadOver != null) { whenDownloadOver(true); } } }); //loader.UpdateFromServer() }
/// <summary> /// 生成资源配置信息: 资源包信息, 资源与包的关系信息 /// </summary> static void CreatResourceinfo() { string outputPath = AssetBundlesOutputPath; //if (Directory.Exists(outputPath)) //{ // Directory.Delete(outputPath, true); //} //Directory.CreateDirectory(outputPath); Dictionary <string, Hash128> abDic = new Dictionary <string, Hash128>(); GetABInfo(outputPath, ref abDic); AssetVersion rinfo = new AssetVersion(); rinfo.bundlesInfo = abDic; abConfig.resourceVersion = rinfo.assetVersion; Debug.Log(rinfo.assetVersion); rinfo.manifestName = outputPath.Substring(outputPath.LastIndexOf("\\") + 1); Debug.Log("manifestname = " + rinfo.manifestName); //File.Create(outputPath+"assetResources.txt", FileHelper.CreateFile(outputPath, "\\assetVersionInfo.txt", rinfo.ToStr(), false); FileHelper.CreateFile(outputPath, "\\abConfig.txt", abConfig.ToString(), false); //AssetVersion localRinfo = DecodeLocalResourcesinfo(); //Debug.Log("old:" + rinfo.ToStr() + " -new:" + localRinfo.ToStr()); ////比较新的assetbundle与之前的是否一致 //if (!AssetVersion.CompareBundlesInfo(rinfo, localRinfo)) //{ // // rinfo.assetVersion = VRFramework.ResourceManager.AssetVersionNum + 1; // abConfig.resourceVersion = rinfo.assetVersion; // Debug.Log(rinfo.assetVersion); // rinfo.manifestName = outputPath.Substring(outputPath.LastIndexOf("\\") + 1); // //File.Create(outputPath+"assetResources.txt", // FileHelper.CreateFile(outputPath, "\\assetVersionInfo.txt", rinfo.ToStr(), false); // FileHelper.CreateFile(outputPath, "\\abConfig.txt", abConfig.ToString(), false); // Debug.LogError("It's not an error!!!! -- 手动替换掉resources目录下的resourceinfo.txt文件"); // return; //} //Debug.Log("新的assetbundle包与原来的一致!"); }