Parcourir la source

增加在登录界面显示版本信息

大爷 il y a 1 an
Parent
commit
f5857190fb

+ 2 - 1
Unity/Assets/Resources/GlobalConfig.asset

@@ -13,6 +13,7 @@ MonoBehaviour:
   m_Name: GlobalConfig
   m_EditorClassIdentifier: 
   CodeMode: 1
-  PlayMode: 2
+  PlayMode: 0
   Version: v0.0.1
   HotfixResUrl: https://star-escort.oss-cn-hangzhou.aliyuncs.com
+  ExeVersion: 1.0

+ 12 - 0
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/UILogin/ShowLoginUIEventHandle.cs

@@ -34,6 +34,7 @@ namespace ET.Client
             { }
 
             var view = await UIHelper.Create( "Login" );
+            bEnd = false;
             InitLogin(view);
         }
 
@@ -220,6 +221,17 @@ namespace ET.Client
 
         private void InitLogin(GComponent view)
         {
+            var globalConfig = Resources.Load<GlobalConfig>("GlobalConfig");
+            var field = typeof(GlobalConfig).GetField("ExeVersion");
+            string exeVersion = "first";
+            if (field != null)
+            {
+                exeVersion = field.GetValue(globalConfig).ToString();
+            }
+            var txtVer = view.GetChild("Text_Version");
+            
+            txtVer.text = $"Main({exeVersion}) Res({YooAsset.YooAssets.GetResourceVersion()})@{globalConfig.Version}";
+
             var comp = view.GetChild("comp_login") as GComponent;
             var listSvr = view.GetChild("listServer").asComboBox;
             var listResolution = view.GetChild("listResolution").asComboBox;

+ 5 - 2
Unity/Assets/Scripts/Loader/MonoBehaviour/GlobalConfig.cs

@@ -17,7 +17,7 @@ namespace ET
     }
 
     [CreateAssetMenu(menuName = "ET/CreateGlobalConfig", fileName = "GlobalConfig", order = 0)]
-    public class GlobalConfig: ScriptableObject
+    public class GlobalConfig : ScriptableObject
     {
         //client/server是否独立运行
         public CodeMode CodeMode = CodeMode.ClientServer;
@@ -35,5 +35,8 @@ namespace ET
 
         [LabelText("AB资源服下载服{host}")]
         public string HotfixResUrl = "https://star-escort.oss-cn-hangzhou.aliyuncs.com";
+
+        [LabelText("主程序版本号")]
+        public string ExeVersion = "1.0";
     }
-}
+}