From 0d5e49f352aa9005b6a80ea32fa15226ce0a413d Mon Sep 17 00:00:00 2001 From: gaoxin Date: Fri, 29 Jan 2021 19:01:40 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90version=E5=B7=A5=E5=85=B7=E3=80=91?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GameEditor/FrameTool/BuildWindow.cs | 151 ++++++++++++++++++ Version/商务-灵动.txt | 1 + Version/商务-蓝鲸.txt | 1 + Version/国内-正式(旧).txt | 1 + Version/国内-测试(旧).txt | 1 + Version/开发-外网测试.txt | 1 + Version/开发-本地测试.txt | 1 + Version/海外-正式服.txt | 1 + Version/海外-测试服.txt | 1 + Version/海外-英文版.txt | 1 + Version/版署.txt | 1 + 11 files changed, 161 insertions(+) create mode 100644 Version/商务-灵动.txt create mode 100644 Version/商务-蓝鲸.txt create mode 100644 Version/国内-正式(旧).txt create mode 100644 Version/国内-测试(旧).txt create mode 100644 Version/开发-外网测试.txt create mode 100644 Version/开发-本地测试.txt create mode 100644 Version/海外-正式服.txt create mode 100644 Version/海外-测试服.txt create mode 100644 Version/海外-英文版.txt create mode 100644 Version/版署.txt diff --git a/Assets/Scripts/Editor/GameEditor/FrameTool/BuildWindow.cs b/Assets/Scripts/Editor/GameEditor/FrameTool/BuildWindow.cs index bc07bf2291..974c924f6d 100644 --- a/Assets/Scripts/Editor/GameEditor/FrameTool/BuildWindow.cs +++ b/Assets/Scripts/Editor/GameEditor/FrameTool/BuildWindow.cs @@ -230,4 +230,155 @@ namespace GameEditor.FrameTool { } } + public class VersionTxt + { + public string subChannel; + public string buglyId; + public string channel; + public string resUrl; + public string packageVersion; + public string version; + public string serverUrl; + } + + + public class VersionWindow : EditorWindow + { + static string versionPath = Application.dataPath + "/../Version"; + static string editorVersion = Application.dataPath + "/../AssetBundles/version.txt"; + static string persistVersion = Application.dataPath + "/Resources/version.txt"; + static string streamVersion = AppConst.StreamPath + "/Resources/version.txt"; + + static VersionTxt m_VersionTxt; // 热更版本 + + + + static string[] m_Files; + static bool[] m_Choose; + static string m_Ver; + + + + + [MenuItem("Build/Version")] + static void Init() + { + LoadVersion(editorVersion); + LoadDic(); + // Get existing open window or if none, make a new one: + VersionWindow window = (VersionWindow)EditorWindow.GetWindow(typeof(VersionWindow)); + window.Show(); + + } + // 加载version文件 + private static void LoadVersion(string path) + { + if (!string.IsNullOrEmpty(path) && File.Exists(path)) + { + string json = File.ReadAllText(path); + m_VersionTxt = JsonUtility.FromJson(json); + } + if (!path.Equals(editorVersion)) + { + SaveToEditorPath(); + } + } + + // 保存到编辑器路径 + private static void SaveToEditorPath() + { + string json = JsonUtility.ToJson(m_VersionTxt); + SaveToVersion(editorVersion, json); + } + // 保存到打包路径 + private static void SaveToBuildPath() + { + string json = JsonUtility.ToJson(m_VersionTxt); + SaveToVersion(persistVersion, json); + SaveToVersion(streamVersion, json); + } + // 保存到version + private static void SaveToVersion(string path, string json) + { + if (!string.IsNullOrEmpty(path) && File.Exists(path)) + { + File.WriteAllText(path, json); + }else + { + UnityEngine.Debug.Log("未找到目标路径:"+path); + } + } + + // 加载version目录 + private static void LoadDic() + { + if (!string.IsNullOrEmpty(versionPath) && Directory.Exists(versionPath)) + { + m_Files = Directory.GetFiles(versionPath, "*", SearchOption.AllDirectories); + m_Choose = new bool[m_Files.Length]; + } + } + void OnGUI() + { + + EditorGUILayout.BeginVertical(); + EditorGUILayout.LabelField("version文件配置:"); + EditorGUILayout.Space(); + EditorGUILayout.LabelField("登录服地址:"); + m_VersionTxt.serverUrl = EditorGUILayout.TextField("", m_VersionTxt.serverUrl); + EditorGUILayout.LabelField("热更CDN地址:"); + m_VersionTxt.resUrl = EditorGUILayout.TextField("", m_VersionTxt.resUrl); + EditorGUILayout.LabelField("渠道:"); + m_VersionTxt.channel = EditorGUILayout.TextField("", m_VersionTxt.channel); + EditorGUILayout.LabelField("子渠道:"); + m_VersionTxt.subChannel = EditorGUILayout.TextField("", m_VersionTxt.subChannel); + EditorGUILayout.LabelField("包版本号:"); + m_VersionTxt.packageVersion = EditorGUILayout.TextField("", m_VersionTxt.packageVersion); + EditorGUILayout.LabelField("热更版本号:"); + m_VersionTxt.version = EditorGUILayout.TextField("", m_VersionTxt.version); + EditorGUILayout.EndVertical(); + + if (GUILayout.Button("应用", GUILayout.Height(40f))) + { + SaveToEditorPath(); + UnityEngine.Debug.Log("应用成功"); + } + EditorGUILayout.BeginVertical(); + EditorGUILayout.Space(); + EditorGUILayout.LabelField("请选择要使用的version文件:"); + if (m_Files != null && m_Files.Length != 0) + { + for (int i = 0; i < m_Files.Length; i++) + { + m_Choose[i] = EditorGUILayout.ToggleLeft(Path.GetFileNameWithoutExtension(m_Files[i]), m_Choose[i]); + } + } + else + { + EditorGUILayout.LabelField("未找到分支"); + } + EditorGUILayout.EndVertical(); + + if (GUILayout.Button("使用选中的version文件", GUILayout.Height(40f))) + { + for (int i = 0; i < m_Files.Length; i++) + { + if (m_Choose[i]) + { + LoadVersion(m_Files[i]); + UnityEngine.Debug.Log("使用成功"); + return; + } + } + UnityEngine.Debug.Log("未找到可用的version"); + } + + + if (GUILayout.Button("保存到打包路径", GUILayout.Height(40f))) + { + SaveToBuildPath(); + UnityEngine.Debug.Log("保存成功"); + } + } + } } diff --git a/Version/商务-灵动.txt b/Version/商务-灵动.txt new file mode 100644 index 0000000000..8ace456950 --- /dev/null +++ b/Version/商务-灵动.txt @@ -0,0 +1 @@ +{"subChannel":"20201222", "buglyId":"261348dcd3", "channel":"MHT", "resUrl":"http://60.1.1.12/jieling_dl/dev/assetBundles/subChannal094-test/", "packageVersion":"0.2", "version":"0.15.0", "serverUrl":"http://119.29.193.45:8080/"} \ No newline at end of file diff --git a/Version/商务-蓝鲸.txt b/Version/商务-蓝鲸.txt new file mode 100644 index 0000000000..a57926ce55 --- /dev/null +++ b/Version/商务-蓝鲸.txt @@ -0,0 +1 @@ +{"buglyId":"261348dcd3", "channel":"37", "resUrl":"http://cdn-jl.lanjingshidai.com/mht_test/", "packageVersion":"0.1", "subChannel":"20201110", "version":"0.1.1", "serverUrl":"http://139.9.223.139:8080/"} \ No newline at end of file diff --git a/Version/国内-正式(旧).txt b/Version/国内-正式(旧).txt new file mode 100644 index 0000000000..463dcf3a63 --- /dev/null +++ b/Version/国内-正式(旧).txt @@ -0,0 +1 @@ +{"buglyId":"261348dcd3", "channel":"MHT", "resUrl":"http://cdn-jl.lanjingshidai.com/mht_release/", "packageVersion":"0.1", "subChannel":"2000", "version":"0.1.0", "serverUrl":"http://106.52.122.168:8080/"} diff --git a/Version/国内-测试(旧).txt b/Version/国内-测试(旧).txt new file mode 100644 index 0000000000..46bcbb4bdd --- /dev/null +++ b/Version/国内-测试(旧).txt @@ -0,0 +1 @@ +{"buglyId":"261348dcd3", "channel":"MHT", "resUrl":"http://cdn-jl.lanjingshidai.com/mht_test/", "packageVersion":"0.1", "subChannel":"1000", "version":"0.1.0", "serverUrl":"http://106.52.122.168:8080/"} diff --git a/Version/开发-外网测试.txt b/Version/开发-外网测试.txt new file mode 100644 index 0000000000..8fd2ec6ef6 --- /dev/null +++ b/Version/开发-外网测试.txt @@ -0,0 +1 @@ +{"buglyId":"261348dcd3", "channel":"MHT", "resUrl":"http://jl.tyu89.wang/mht_test/", "packageVersion":"0.1", "subChannel":"20000", "version":"0.1.2", "serverUrl":"http://139.9.223.139:8080/"} \ No newline at end of file diff --git a/Version/开发-本地测试.txt b/Version/开发-本地测试.txt new file mode 100644 index 0000000000..2e7c327b3c --- /dev/null +++ b/Version/开发-本地测试.txt @@ -0,0 +1 @@ +{"buglyId":"261348dcd3", "channel":"MHT", "resUrl":"http://jl.tyu89.wang/mht/en/", "packageVersion":"0.1", "subChannel":"10000", "version":"0.16.1", "serverUrl":"http://139.9.223.139:8080/"} \ No newline at end of file diff --git a/Version/海外-正式服.txt b/Version/海外-正式服.txt new file mode 100644 index 0000000000..1bd0773d9e --- /dev/null +++ b/Version/海外-正式服.txt @@ -0,0 +1 @@ +{"subChannel":"2000", "buglyId":"261348dcd3", "channel":"MHT", "resUrl":"http://jl.tyu89.wang/mht_hw_release/", "packageVersion":"0.1", "version":"0.1.1", "serverUrl":"http://119.28.117.110:8080/"} \ No newline at end of file diff --git a/Version/海外-测试服.txt b/Version/海外-测试服.txt new file mode 100644 index 0000000000..f03eff4181 --- /dev/null +++ b/Version/海外-测试服.txt @@ -0,0 +1 @@ +{"subChannel":"1000", "buglyId":"261348dcd3", "channel":"MHT", "resUrl":"http://jl.tyu89.wang/mht_hw_test/", "packageVersion":"0.1", "version":"0.1.0", "serverUrl":"http://119.28.117.110:8080/"} \ No newline at end of file diff --git a/Version/海外-英文版.txt b/Version/海外-英文版.txt new file mode 100644 index 0000000000..430ceba5e1 --- /dev/null +++ b/Version/海外-英文版.txt @@ -0,0 +1 @@ +{"buglyId":"261348dcd3", "channel":"MHT", "resUrl":"http://jl.tyu89.wang/mht/en/", "packageVersion":"0.1", "subChannel":"10000", "version":"0.1.1", "serverUrl":"http://139.9.223.139:8080/"} \ No newline at end of file diff --git a/Version/版署.txt b/Version/版署.txt new file mode 100644 index 0000000000..9248d0d93f --- /dev/null +++ b/Version/版署.txt @@ -0,0 +1 @@ +{"subChannel":"888", "buglyId":"b67b061643", "channel":"pc", "resUrl":"http://cdn-jl.lanjingshidai.com/banshu/", "packageVersion":"0.1", "version":"0.1.1", "serverUrl":"http://154.8.225.157:8080/"} \ No newline at end of file