// #endif #region assetbundle public static void GenerateAssetBundlesUpdateFile(string[] allBundles) { string title = "Generate Update File "; string info = "Compute crc32"; EditorUtility.DisplayProgressBar(title, info, 0.1f); var hotResGenSharedData = new HotResGenSharedData(); //流程封装方便自己定义流程 // HugulaPlayerPrefs.SetString(Hugula.Editor.EditorCommon.KeyVerChannels,"imsdk"); string KeyVerChannels = HugulaPlayerPrefs.GetString(EditorCommon.KeyVerChannels, string.Empty); Debug.LogFormat("GenerateAssetBundlesUpdateFile KeyVerChannels:{0}", KeyVerChannels); TaskManager <HotResGenSharedData> .AddTask(new ReadFirst(allBundles)); TaskManager <HotResGenSharedData> .AddTask(new CreateCrcListContent()); TaskManager <HotResGenSharedData> .AddTask(new CreateLocalFileManifest()); TaskManager <HotResGenSharedData> .AddTask(new CreateDiffFileManifest()); TaskManager <HotResGenSharedData> .AddTask(new CreateVersionAssetBundle(KeyVerChannels)); TaskManager <HotResGenSharedData> .AddTask(new CopyChangeFiles()); TaskManager <HotResGenSharedData> .AddTask(new ClearAssetBundle()); TaskManager <HotResGenSharedData> .AddTask(new ZipBundles()); System.Action <float, string> act = (float p, string name) => { EditorUtility.DisplayProgressBar(title, name, p); Debug.Log(" process =" + name); }; TaskManager <HotResGenSharedData> .Run(hotResGenSharedData, act); hotResGenSharedData.manualFileList.WriteToFile("Assets/" + EditorUtils.TmpPath + "manualFileList.txt"); HugulaPlayerPrefs.DeleteKey(EditorCommon.KeyVerChannels); EditorUtility.ClearProgressBar(); }
public static void GenerateAssetBundlesUpdateFile(string[] allBundles) { string title = "Generate Update File "; string info = "Compute crc32"; EditorUtility.DisplayProgressBar(title, info, 0.1f); var hotResGenSharedData = new HotResGenSharedData(); //流程封装方便自己定义流程 TaskManager <HotResGenSharedData> .AddTask(new ReadFirst()); TaskManager <HotResGenSharedData> .AddTask(new CreateCrcListContent(allBundles)); TaskManager <HotResGenSharedData> .AddTask(new CreateLocalFileManifest()); TaskManager <HotResGenSharedData> .AddTask(new CreateDiffFileManifest()); TaskManager <HotResGenSharedData> .AddTask(new CreateVersionAssetBundle()); TaskManager <HotResGenSharedData> .AddTask(new CopyChangeFiles()); TaskManager <HotResGenSharedData> .AddTask(new ClearAssetBundle()); TaskManager <HotResGenSharedData> .AddTask(new ZipBundles()); System.Action <float, string> act = (float p, string name) => { EditorUtility.DisplayProgressBar(title, name, p); Debug.Log(" process =" + name); }; TaskManager <HotResGenSharedData> .Run(hotResGenSharedData, act); hotResGenSharedData.manualFileList.WriteToFile("Assets/" + TmpPath + "manualFileList.txt"); /* * FileManifest firstCrcDict = null;//首包 * FileManifest streamingManifest = null;//streamingAsset * FileManifest manualFileList = ScriptableObject.CreateInstance(typeof(FileManifest)) as FileManifest;//后置下载 #region 读取首包 * bool firstExists = SplitPackage.ReadFirst(out firstCrcDict, out streamingManifest, manualFileList); * Debug.Log("manualFileList.Count =" + manualFileList.Count); #endregion * * SplitPackage.DeleteSplitPackageResFolder(); * #region 生成校验列表 * SplitPackage.UpdateOutPath = null; SplitPackage.UpdateOutDevelopPath = null; * // 生成差异内容 * var abInfoArray = SplitPackage.CreateCrcListContent(allBundles, firstCrcDict, streamingManifest, manualFileList); * // local streamingManifest * var streamingManifestClone = ScriptableObject.CreateInstance(typeof(FileManifest)) as FileManifest; * streamingManifestClone.allAbInfo = streamingManifest.allAbInfo; * streamingManifestClone.allAssetBundlesWithVariant = streamingManifest.allAssetBundlesWithVariant; * streamingManifestClone.OnAfterDeserialize(); * uint streaming_crc = SplitPackage.CreateStreamingCrcList(streamingManifestClone, Common.CRC32_FILELIST_NAME, firstExists); //本地列表 * //diff * var diffstreamingManifest = ScriptableObject.CreateInstance(typeof(FileManifest)) as FileManifest; * diffstreamingManifest.allAbInfo = abInfoArray[0]; * diffstreamingManifest.allAssetBundlesWithVariant = streamingManifest.allAssetBundlesWithVariant; * diffstreamingManifest.OnAfterDeserialize(); * uint diff_crc = SplitPackage.CreateStreamingCrcList(diffstreamingManifest, Common.CRC32_FILELIST_NAME, true, true); //增量列表 * * CUtils.DebugCastTime("Time CreateStreamingCrcList End"); #endregion * #region 生成版本号 * //生成版本号码 * SplitPackage.CreateVersionAssetBundle(diff_crc, true, !CUtils.isRelease); * SplitPackage.CreateVersionAssetBundle(diff_crc, false, true); * CUtils.DebugCastTime("Time CreateVersionAssetBundle End"); #endregion * #region copy更新文件导出 * * Debug.Log(firstCrcDict); * streamingManifestClone.WriteToFile("Assets/" + TmpPath + "streamingManifest.txt"); * diffstreamingManifest.WriteToFile("Assets/" + TmpPath + "diffstreamingManifest.txt"); * manualFileList.WriteToFile("Assets/" + TmpPath + "manualFileList.txt"); * SplitPackage.CopyChangeFileToSplitFolder(firstExists, firstCrcDict, streamingManifest, diffstreamingManifest, manualFileList); * * CUtils.DebugCastTime("Time CopyChangeFileToSplitFolder End"); * * // Debug.LogFormat(" firstCrcDict={0},currCrcDict={1},diffCrcDict={2},manualFileList={3}", firstCrcDict.Count, streamingManifest.Count, diffstreamingManifest.Count, manualFileList.Count); * * if (CheckZipPlatform()) * SplitPackage.ZipAssetbundles(); * else * { * ZipConfigs.Delete(); * } #endregion * #region 删除手动加载文件 #if (UNITY_ANDROID || UNITY_IOS) && HUGULA_RELEASE * bool spExtFolder = HugulaSetting.instance.spliteExtensionFolder; * if (spExtFolder) * { * SplitPackage.DeleteStreamingFiles(manualFileList.allAbInfo); * } #endif #endregion */ EditorUtility.ClearProgressBar(); }