Browse Source

断线重连优化

guodong 2 years ago
parent
commit
ddf6a65cd2

+ 0 - 4
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs

@@ -257,10 +257,6 @@ namespace GFGGame
 
 
         public static async ETTask ReqReConnectGate()
         public static async ETTask ReqReConnectGate()
         {
         {
-            if(!Application.isFocused)
-            {
-                return;
-            }
             ViewManager.Show<ModalStatusView>("重新连接中...");
             ViewManager.Show<ModalStatusView>("重新连接中...");
             int errorCode = await LoginHelper.EnterGame(GameGlobal.zoneScene);
             int errorCode = await LoginHelper.EnterGame(GameGlobal.zoneScene);
             if (errorCode != ErrorCode.ERR_Success)
             if (errorCode != ErrorCode.ERR_Success)

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

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
 using GFGGame;
 using GFGGame;
+using UnityEngine;
 
 
 namespace ET
 namespace ET
 {
 {
@@ -15,13 +16,27 @@ namespace ET
             {
             {
                 if(GameGlobal.zoneScene.GetComponent<SessionComponent>().SessionState == SessionState.Gate)
                 if(GameGlobal.zoneScene.GetComponent<SessionComponent>().SessionState == SessionState.Gate)
                 {
                 {
-                    LoginController.ReqReConnectGate().Coroutine();
+
+                    if (!Application.isFocused)
+                    {
+                        AlertSystem.Show("连接已断开。")
+                        .SetRightButton(true, "重新连接", (object data) =>
+                        {
+                            LoginController.ReqReConnectGate().Coroutine();
+                        });
+                        return;
+                    }
+                    else
+                    {
+                        LoginController.ReqReConnectGate().Coroutine();
+                    }
                 }
                 }
                 else
                 else
                 {
                 {
                     GameController.QuitToLoginView(false);
                     GameController.QuitToLoginView(false);
                 }
                 }
             }
             }
+            //重置状态
             self.ToReconnect = true;
             self.ToReconnect = true;
         }
         }
     }
     }