Jelajahi Sumber

启动流程优化

guodong 3 tahun lalu
induk
melakukan
2bee4526a5

+ 17 - 1
GameClient/Assets/Game/Launcher/GameLauncher.cs

@@ -51,10 +51,26 @@ public class GameLauncher : MonoBehaviour
             LauncherView.Instance.SetDesc("正在初始化...");
             //第一个节点必须放在平台配置加载之后
             LogServerHelperHttp.SendNodeLog((int)LogNode.OnStart);
-            CheckApkVersion();
+            CheckGameStatus();
         });
     }
 
+    public void CheckGameStatus()
+    {
+        if(LauncherConfig.serverStatus == 1)
+        {
+            Alert.Show("游戏正在维护中,请稍后再试。")
+                .SetLeftButton(true, "知道了", (data) => {
+
+                    Application.Quit();
+                });
+        }
+        else
+        {
+            CheckApkVersion();
+        }
+    }
+
     private void CheckApkVersion()
     {
         LauncherView.Instance.SetDesc("正在校验应用版本...");

+ 6 - 1
GameClient/Assets/Game/Launcher/LauncherConfig.cs

@@ -1,5 +1,4 @@
 using LitJson;
-using UnityEngine;
 
 namespace GFGGame
 {
@@ -25,6 +24,7 @@ namespace GFGGame
         public static string logKey;
         public static string logApiUrl;
         public static string apkVersion;
+        public static int serverStatus;
 
         public static string resKey
         {
@@ -65,6 +65,9 @@ namespace GFGGame
             LauncherConfig.logApiUrl = result.logApiUrl;
             LauncherConfig.logKey = result.logKey;
             LauncherConfig.apkVersion = result.apkVersion;
+            LauncherConfig.serverStatus = int.Parse(result.serverStatus);
+            LauncherConfig.platformId = int.Parse(result.platformId);
+            ET.Log.Debug($"platformId {LauncherConfig.platformId}");
         }
 
         private struct Result
@@ -74,6 +77,8 @@ namespace GFGGame
             public string logApiUrl;
             public string logKey;
             public string apkVersion;
+            public string serverStatus;
+            public string platformId;
         }
 
     }