瀏覽代碼

启动流程优化

guodong 3 年之前
父節點
當前提交
2bee4526a5
共有 2 個文件被更改,包括 23 次插入2 次删除
  1. 17 1
      GameClient/Assets/Game/Launcher/GameLauncher.cs
  2. 6 1
      GameClient/Assets/Game/Launcher/LauncherConfig.cs

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

@@ -51,10 +51,26 @@ public class GameLauncher : MonoBehaviour
             LauncherView.Instance.SetDesc("正在初始化...");
             LauncherView.Instance.SetDesc("正在初始化...");
             //第一个节点必须放在平台配置加载之后
             //第一个节点必须放在平台配置加载之后
             LogServerHelperHttp.SendNodeLog((int)LogNode.OnStart);
             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()
     private void CheckApkVersion()
     {
     {
         LauncherView.Instance.SetDesc("正在校验应用版本...");
         LauncherView.Instance.SetDesc("正在校验应用版本...");

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

@@ -1,5 +1,4 @@
 using LitJson;
 using LitJson;
-using UnityEngine;
 
 
 namespace GFGGame
 namespace GFGGame
 {
 {
@@ -25,6 +24,7 @@ namespace GFGGame
         public static string logKey;
         public static string logKey;
         public static string logApiUrl;
         public static string logApiUrl;
         public static string apkVersion;
         public static string apkVersion;
+        public static int serverStatus;
 
 
         public static string resKey
         public static string resKey
         {
         {
@@ -65,6 +65,9 @@ namespace GFGGame
             LauncherConfig.logApiUrl = result.logApiUrl;
             LauncherConfig.logApiUrl = result.logApiUrl;
             LauncherConfig.logKey = result.logKey;
             LauncherConfig.logKey = result.logKey;
             LauncherConfig.apkVersion = result.apkVersion;
             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
         private struct Result
@@ -74,6 +77,8 @@ namespace GFGGame
             public string logApiUrl;
             public string logApiUrl;
             public string logKey;
             public string logKey;
             public string apkVersion;
             public string apkVersion;
+            public string serverStatus;
+            public string platformId;
         }
         }
 
 
     }
     }