/// <summary> /// 请使用异步压缩或者解压。 /// </summary> void OnGUI() { if (GUI.Button(new Rect(Screen.width / 2 - 210, 200, 140, 80), "生成app配置文件")) { initAppConfig(); } if (GUI.Button(new Rect(Screen.width / 2 + 70, 200, 140, 80), "压缩配置文件")) { UPKFolder.PackFolder(path, path + "/appConfig.upk", null); } //if (GUI.Button(new Rect(Screen.width / 2 - 210, 320, 140, 80), "LMZA解压文件")) //{ // LZMAFile.DeCompressAsync(Application.dataPath + "/music.lzma", Application.dataPath + "/lzmamusic.mp3", ShowProgress); //} //if (GUI.Button(new Rect(Screen.width / 2 + 70, 320, 140, 80), "GZIP解压文件")) //{ // GZipFile.DeCompressAsync(Application.dataPath + "/music.gzip", Application.dataPath + "/gzipmusic.mp3", ShowProgress); //} //if (GUI.Button(new Rect(Screen.width / 2 - 210, 440, 140, 80), "UPK打包文件夹")) //{ // UPKFolder.PackFolder(Application.dataPath + "/picture", Application.dataPath + "/picture.upk", ShowProgress); // // UPKFolder.PackFolderAsync(Application.dataPath + "/picture", Application.dataPath + "/picture.upk", ShowProgress); //} //if (GUI.Button(new Rect(Screen.width / 2 + 70, 440, 140, 80), "UPK解包文件夹")) //{ // UPKFolder.UnPackFolder(Application.dataPath + "/picture.upk", Application.dataPath + "/", ShowProgress); // //UPKFolder.UnPackFolderAsync(Application.dataPath + "/picture.upk", Application.dataPath + "/", ShowProgress); //} }
/// <summary> /// 解压缩 /// </summary> /// <param name="inPath">需要解压文件路径</param> /// <param name="outPath">解压输出路径</param> /// <param name="progress">解压进度</param> public static void UnPackFolder(string inPath, string outPath, Action <float> progress = null) { UPKFolder.UnPackFolder(inPath, outPath, (all, now) => { if (progress != null) { progress(now / all); } }); }
public override void DoGameUpdate(Action callback) { //更新版本配置信息 upk包 Downloader.DownLoaderFile(serConfigAddr, _ => { FileUtil.ClearDirectory(appConfigPath_new); FileUtil.SaveFile(appConfigPath_new + "/appConfig.upk", _); UPKFolder.UnPackFolder(appConfigPath_new + "/appConfig.upk", appConfigPath_new + "/", null); System.IO.File.Delete(appConfigPath_new + "/appConfig.upk"); // 比较gameversion 而后更新dll,下载新的ab包 (一次性更新所有dll) compareAndUpdate(); //替换配置信息 replaceConfig(); initAssetManager(); }); }
public static void UnPackAssetFolder(string inpath, string outpath) { UPKFolder.UnPackFolder(inpath, outpath, ShowProgress); }
public static void UnPackageAssets() { UPKFolder.UnPackFolderAsync(Application.persistentDataPath + "/MyAssets.upk", Application.persistentDataPath + "/", ShowProgress); AssetDatabase.Refresh(); }
public static void PackageAssets() { UPKFolder.PackFolderAsync(Application.streamingAssetsPath + "/" + "MyAssets", Application.streamingAssetsPath + "/" + "MyAssets.upk", ShowProgress); AssetDatabase.Refresh(); }