static XGameUpdate.UpdateFileInfo GenFiles(string inputPath, bool isCry) { if (inputPath == null || inputPath.Equals("")) { return(null); } var fi = new XGameUpdate.UpdateFileInfo(); var dir = inputPath.Split('/'); //压缩出来的文件加个随机数 fi.name = dir[dir.Length - 1]; int randomNum = UnityEngine.Random.Range(0, 999999999); fi.packageName = fi.name + "_" + randomNum; ForeachFile(inputPath, (string f) => { Debug.LogWarning("genfile " + f); if (Path.GetExtension(f).Equals("meta")) { File.Delete(f); } else { if (isCry) { CryFile(f); } } }); var outPath = inputPath + "_" + randomNum + ".zip"; if (File.Exists(outPath)) { if (File.Exists(outPath + "_bk")) { File.Delete(outPath + "_bk"); } File.Move(outPath, outPath + "_bk"); } Debug.LogError("zipfile " + inputPath); DWTools.FastZipCompress(inputPath, outPath); fi.md5 = DWTools.GenMD5(outPath); fi.length = GetFileLength(outPath); return(fi); }
void OnGUI() { m_ScrollViewPos = EditorGUILayout.BeginScrollView(m_ScrollViewPos, false, false, GUILayout.Height(Screen.height - 30)); GUILayout.Label("当前游戏程序版本号:" + UnityEditor.PlayerSettings.bundleVersion); if (GUILayout.Button("选择update_config文件路径")) { m_jsonFilePath = EditorUtility.OpenFilePanel("选择update_config文件路径", "", "json"); LoadVUFile(m_jsonFilePath); } GUILayout.Label(""); m_drawAppFolder = EditorGUILayout.Foldout(m_drawAppFolder, new GUIContent("App版本信息")); if (m_drawAppFolder) { DrawAppInfo(); } m_drawPackUrl = EditorGUILayout.Foldout(m_drawPackUrl, new GUIContent("安装包信息")); if (m_drawPackUrl) { DrawPackageUrl(); } var s = new GUIStyle(); s.richText = true; var text = ""; GUILayout.Label(""); var delGameVerIndex = new List <int>(); for (int i = 0; m_versionInfo != null && m_versionInfo.dynamicUpdateInfo != null && i < m_versionInfo.dynamicUpdateInfo.Count; ++i) { text = "<color=green>删除程序版本</color>"; if (GUILayout.Button(text, s)) { delGameVerIndex.Add(i); } var vui = m_versionInfo.dynamicUpdateInfo[i]; m_folders[i].versionFolder = EditorGUILayout.Foldout(m_folders[i].versionFolder, "游戏程序版本" + vui.baseVersion + " 更新信息"); vui.baseVersion = EditorGUILayout.TextField("程序版本:", vui.baseVersion); if (m_folders[i].versionFolder) { var delPlatformIndex = new List <int>(); for (int j = 0; j < vui.resVersionInfo.Count; ++j) { text = "<color=yellow> 删除资源版本</color>"; if (GUILayout.Button(text, s)) { delPlatformIndex.Add(j); } var pui = vui.resVersionInfo[j]; int platform; pui.resVersion = EditorGUILayout.TextField(" 兼容资源版本:", pui.resVersion); pui.forceUpdate = bool.Parse(EditorGUILayout.TextField(" 可否跳过资源版本更新:", pui.forceUpdate.ToString())); if (int.TryParse(EditorGUILayout.TextField(" 平台:", pui.basePlatform.ToString()), out platform)) { pui.basePlatform = platform; } if (int.TryParse(EditorGUILayout.TextField(" 测试服务器ID:", pui.testSvrId.ToString()), out platform)) { pui.testSvrId = platform; } var delResVersionIndex = new List <int>(); Action <string, string> ressCB = (string buttonName, string ressName) => { EditorGUILayout.BeginHorizontal(EditorStyles.objectFieldThumb, GUILayout.ExpandWidth(true)); if (GUILayout.Button(buttonName, GUILayout.Width(120))) { XGameUpdate.UpdateFileInfo fi = null; switch (ressName) { case "Table": fi = GenTableData(); break; case "AssetBundles": //fi = GenAssetsBundle(pui.resVersion); fi = GenAssetsBundle_New(); break; case "Lua": fi = GenLua(); break; case "DLL": fi = GenDLL(); break; case "MapFile": fi = GenMapFile(); break; case "Audio": fi = GenAudio(); break; } if (fi != null) { AddUpdateInfo(ref pui, new XGameUpdate.resInfo(fi)); } } XGameUpdate.resInfo ressInfo = pui.resInfo.Find((XGameUpdate.resInfo findvalue) => { return(findvalue.type == ressName); }); if (ressInfo != null) { ressInfo.md5 = EditorGUILayout.TextField("", ressInfo.md5); if (string.IsNullOrEmpty(ressInfo.md5)) { pui.resInfo.Remove(ressInfo); } } else { EditorGUILayout.TextField("", ""); } EditorGUILayout.EndHorizontal(); }; ressCB("选择TableData文件夹", "Table"); ressCB("选择AssetBundles文件夹", "AssetBundles"); ressCB("选择DLL文件夹", "DLL"); ressCB("选择Lua文件夹", "Lua"); ressCB("选择MapFile文件夹", "MapFile"); ressCB("选择Audio文件夹", "Audio"); } for (int j = 0; j < delPlatformIndex.Count; ++j) { vui.resVersionInfo.RemoveAt(delPlatformIndex[j]); ResetFolders(); } } text = "<color=yellow>添加资源版本</color>"; if (GUILayout.Button(text, s)) { var pui = new XGameUpdate.AppUpdateInfo(); vui.resVersionInfo.Add(pui); ResetFolders(); } } text = "<color=green>添加程序版本</color>"; if (GUILayout.Button(text, s)) { var vui = new XGameUpdate.UpdatePackageInfo(); m_versionInfo.dynamicUpdateInfo.Add(vui); ResetFolders(); } for (int i = 0; i < delGameVerIndex.Count; ++i) { m_versionInfo.dynamicUpdateInfo.RemoveAt(delGameVerIndex[i]); ResetFolders(); } GUILayout.Label(""); if (GUILayout.Button("保存")) { Save(); } EditorGUILayout.EndScrollView(); }