From 28dbfe57eb2fbf3740382288763fe66ced6b59c5 Mon Sep 17 00:00:00 2001 From: JLIOSM1 <774727341@qq.com> Date: Mon, 6 Dec 2021 13:19:33 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=89=93=E5=8C=85=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E3=80=91=E6=B7=BB=E5=8A=A0IOS=E6=89=93=E5=8C=85=E5=B7=A5?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=9A=84=E9=83=A8=E5=88=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Editor/AutoPack.cs | 67 +++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/Assets/Editor/AutoPack.cs b/Assets/Editor/AutoPack.cs index 1813376714..781e9e4a07 100644 --- a/Assets/Editor/AutoPack.cs +++ b/Assets/Editor/AutoPack.cs @@ -36,7 +36,7 @@ public class AutoPack : EditorWindow #elif UNITY_IOS static string Platform = "IOS"; static string ConfigFileName = "config.txt"; - static string VersionFileName = "game.info"; + static string VersionFileName = "version.txt"; #else static string Platform = "Android"; static string ConfigFileName = "config.txt"; @@ -171,16 +171,32 @@ public class AutoPack : EditorWindow string tpath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[i].version + "/" + VersionFileName; GameEditor.Util.ProcessUtil.OpenText(tpath); } - if (GUILayout.Button("编辑Gradle", GUILayout.Height(20f))) + if (GameLogic.AppConst.PlatformPath.Equals("Android")) { - string tpath = _MomPackPath + PackConfig[i].project + "/build.gradle"; - GameEditor.Util.ProcessUtil.OpenText(tpath); + if (GUILayout.Button("编辑Gradle", GUILayout.Height(20f))) + { + string tpath = _MomPackPath + PackConfig[i].project + "/build.gradle"; + GameEditor.Util.ProcessUtil.OpenText(tpath); + } + if (GUILayout.Button("更新蓝鲸SDK", GUILayout.Height(20f))) + { + File.Copy(_MomPackPath + "BlueWhaleJar/app/build/outputs/aar/app-release.aar", _MomPackPath + PackConfig[i].project + "/libs/BlueWhale.aar", true); + Debug.Log("更新完成"); + } + } - if (GUILayout.Button("更新蓝鲸SDK", GUILayout.Height(20f))) + else { - File.Copy(_MomPackPath + "BlueWhaleJar/app/build/outputs/aar/app-release.aar", _MomPackPath + PackConfig[i].project + "/libs/BlueWhale.aar", true); - Debug.Log("更新完成"); + if (GUILayout.Button("同步配置文件", GUILayout.Height(20f))) + { + ReplaceConfigAndVersion(i); + } + if (GUILayout.Button("开始混淆", GUILayout.Height(20f))) + { + EncryptAB(i); + } } + EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); @@ -422,6 +438,10 @@ public class AutoPack : EditorWindow private static void EncryptAB(int index) { string toPath = _MomPackPath + PackConfig[index].project + "/src/main/assets/Android"; + if (GameLogic.AppConst.PlatformPath.Equals("IOS")) + { + toPath = _MomPackPath + PackConfig[index].project + "/Data/Raw/IOS"; + } string json = File.ReadAllText(toPath + "/"+ VersionFileName); VersionTxt version = JsonUtility.FromJson(json); @@ -449,16 +469,29 @@ public class AutoPack : EditorWindow // 替换配置文件 private static void ReplaceConfigAndVersion(int index) { - EditorUtility.DisplayProgressBar("替换配置文件1", "", 0.5f); - string fromPath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[index].version + "/"; - string toPath = _MomPackPath + PackConfig[index].project + "/Config/"; - File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true); - File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true); - EditorUtility.DisplayProgressBar("替换配置文件2", "", 0.5f); - fromPath = toPath; - toPath = _MomPackPath + PackConfig[index].project + "/src/main/assets/Android/"; - File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true); - File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true); + if (GameLogic.AppConst.PlatformPath.Equals("Android")) { + + //EditorUtility.DisplayProgressBar("替换配置文件1", "", 0.5f); + string fromPath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[index].version + "/"; + string toPath = _MomPackPath + PackConfig[index].project + "/Config/"; + File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true); + File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true); + //EditorUtility.DisplayProgressBar("替换配置文件2", "", 0.5f); + fromPath = toPath; + toPath = _MomPackPath + PackConfig[index].project + "/src/main/assets/Android/"; + File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true); + File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true); + } + else + { + //EditorUtility.DisplayProgressBar("替换配置文件", "", 0.5f); + string fromPath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[index].version + "/"; + string toPath = _MomPackPath + PackConfig[index].project + "/Data/Raw/IOS/"; + File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true); + File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true); + } + + Debug.Log(PackConfig[index].name+":配置文件替换完成"); EditorUtility.ClearProgressBar(); }