Przeglądaj źródła

断网重连提示

guodong 1 rok temu
rodzic
commit
bb0c539ac3

+ 17 - 5
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs

@@ -273,14 +273,26 @@ namespace GFGGame
             int errorCode = await LoginHelper.EnterGame(GameGlobal.zoneScene);
             if (errorCode != ErrorCode.ERR_Success)
             {
-                if (errorCode != ErrorCode.ERR_SessionStateError && errorCode != ErrorCode.ERR_NetWorkError)
+                string errMessage = "与服务器连接失败。";
+                Log.Error($"Reconnect fail, errorCode {errorCode}!");
+                if(errorCode == ErrorCode.ERR_TokenError)
                 {
-                    Log.Error($"Reconnect fail, errorCode {errorCode}!");
+                    errMessage = "登录已过期,请重新登录";
+                    AlertSystem.Show(errMessage)
+                            .SetRightButton(true, "好的", (object data) =>
+                            {
+                                GameController.QuitToLoginView(false);
+                            });
+                    return;
                 }
-                AlertSystem.Show("重新连接失败,游戏或已更新,请重新进入游戏获得最佳体验。")
-                        .SetRightButton(true, "好的", (object data) =>
+                else if(errorCode == ErrorCode.ERR_NetWorkError)
+                {
+                    errMessage = "网络异常,与服务器连接失败。";
+                }
+                AlertSystem.Show(errMessage)
+                        .SetRightButton(true, "重新连接", (object data) =>
                         {
-                            Application.Quit();
+                            ReqReConnectGate().Coroutine();
                         });
                 return;
             }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/DisConnected/DisConnectedCompnentSystem.cs

@@ -19,7 +19,7 @@ namespace ET
 
                     if (!Application.isFocused)
                     {
-                        AlertSystem.Show("连接已断开。")
+                        AlertSystem.Show("与服务器连接已断开。")
                         .SetRightButton(true, "重新连接", (object data) =>
                         {
                             LoginController.ReqReConnectGate().Coroutine();

+ 12 - 0
GameClient/Assets/Game/HotUpdate/Views/Common/Alert/AlertSystem.cs

@@ -44,6 +44,18 @@ namespace GFGGame
         {
             _alertWindow = null;
         }
+
+        public static bool IsShow
+        {
+            get
+            {
+                if (_alertWindow == null)
+                {
+                    return false;
+                }
+                return _alertWindow.isShowing;
+            }
+        }
     }
 
 }