Browse Source

添加开服时间检查

guodong 2 years ago
parent
commit
8235f15c9f

+ 7 - 0
GameClient/Assets/Game/HotUpdate/GameConfig.cs

@@ -12,6 +12,8 @@ namespace GFGGame
         public static string PlatformName;
         public static string logApiReportUrl;
         public static int showGM;
+        //开服时间
+        public static long openTime = 0;
 
         public static void InitData(string json)
         {
@@ -22,6 +24,10 @@ namespace GFGGame
             //LoginAddress = "127.0.0.1:10005";//测试地址
             PlatformName = result.platformName;
             showGM = int.Parse(result.showGM);
+            if(!string.IsNullOrEmpty(result.openTime))
+            {
+                openTime = TimeUtil.GetTimestamp(result.openTime);
+            }
             GameConfig.logApiReportUrl = LauncherConfig.logApiRootUrl + "ReportGet";
         }
 
@@ -30,6 +36,7 @@ namespace GFGGame
             public string loginApiUrl;
             public string platformName;
             public string showGM;
+            public string openTime;
         }
     }
 }

+ 10 - 0
GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs

@@ -83,6 +83,16 @@ namespace GFGGame
             //_ui.m_btnAgree.selected = LocalCache.GetBool(GameConst.LAST_LOGIN_IS_AGREE_KEY, false);
             _ui.m_btnAgree.selected = true;
 
+            if(GameConfig.openTime > TimeHelper.ClientNow())
+            {
+                AlertUI.Show("未到开放时间!")
+                        .SetLeftButton(true, "稍后再试", (obj) =>
+                        {
+                            Application.Quit();
+                        });
+                return;
+            }
+
             if (QDManager.isInited)
             {
                 EventAgent.DispatchEvent(ConstMessage.ON_PLATFORM_SDK_INITED, true);