Browse Source

登录优化

guodong 3 years ago
parent
commit
990309a133

+ 1 - 1
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Account/A2C_DisconnectHandler.cs

@@ -10,7 +10,7 @@ namespace ET
     {
     {
         protected override async ETTask Run(Session session, A2C_Disconnect message)
         protected override async ETTask Run(Session session, A2C_Disconnect message)
         {
         {
-            session.RemoveComponent<DisConnectedCompnent>();
+            session?.GetComponent<DisConnectedCompnent>()?.CancelAlert();
             session.Dispose();
             session.Dispose();
             switch(message.Error)
             switch(message.Error)
             {
             {

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

@@ -6,20 +6,28 @@ using GFGGame;
 
 
 namespace ET
 namespace ET
 {
 {
+
     public class DisConnectedCompnentDestroy : DestroySystem<DisConnectedCompnent>
     public class DisConnectedCompnentDestroy : DestroySystem<DisConnectedCompnent>
     {
     {
         public override void Destroy(DisConnectedCompnent self)
         public override void Destroy(DisConnectedCompnent self)
         {
         {
-            Alert.Show("服务器连接已断开!")
-                .SetLeftButton(true, "返回登录",(obj) =>
-                {
-                    GameController.QuitToLoginView(false);
-                });
+            if(self.showAlert)
+            {
+                Alert.Show("服务器连接已断开!")
+                    .SetLeftButton(true, "返回登录", (obj) =>
+                    {
+                        GameController.QuitToLoginView(false);
+                    });
+            }
+            self.showAlert = true;
         }
         }
     }
     }
 
 
     public static class DisConnectedCompnentSystem
     public static class DisConnectedCompnentSystem
     {
     {
-        
+        public static void CancelAlert(this DisConnectedCompnent self)
+        {
+            self.showAlert = false;
+        }
     }
     }
 }
 }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Login/LoginHelper.cs

@@ -292,7 +292,7 @@ namespace ET
 
 
             zoneScene.GetComponent<AccountInfoComponent>().RealmKey = a2C_GetRealmKey.RealmKey;
             zoneScene.GetComponent<AccountInfoComponent>().RealmKey = a2C_GetRealmKey.RealmKey;
             zoneScene.GetComponent<AccountInfoComponent>().RealmAddress = a2C_GetRealmKey.RealmAddress;
             zoneScene.GetComponent<AccountInfoComponent>().RealmAddress = a2C_GetRealmKey.RealmAddress;
-            zoneScene.GetComponent<SessionComponent>().Session.Dispose();
+            zoneScene.GetComponent<SessionComponent>().Disconnect();
 
 
             await ETTask.CompletedTask;
             await ETTask.CompletedTask;
             return ErrorCode.ERR_Success;
             return ErrorCode.ERR_Success;

+ 8 - 0
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Session/SessionComponentSystem.cs

@@ -7,4 +7,12 @@
 			self.Session.Dispose();
 			self.Session.Dispose();
 		}
 		}
 	}
 	}
+
+	public static class SessionComponentComponent
+    {
+		public static void Disconnect(this SessionComponent self)
+        {
+			self.Session?.GetComponent<DisConnectedCompnent>()?.CancelAlert();
+		}
+    }
 }
 }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/ETCodes/Model/App/DisConnected/DisConnectedCompnent.cs

@@ -8,6 +8,6 @@ namespace ET
 {
 {
     public class DisConnectedCompnent : Entity, IAwake, IDestroy
     public class DisConnectedCompnent : Entity, IAwake, IDestroy
     {
     {
-
+        public bool showAlert = true;
     }
     }
 }
 }