Ver Fonte

登录优化

guodong há 3 anos atrás
pai
commit
29d6a0d7d6

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

@@ -133,6 +133,7 @@ namespace GFGGame
 
         public static void Logout()
         {
+            GameGlobal.zoneScene.GetComponent<SessionComponent>().AccountSession?.Dispose();
             GameGlobal.zoneScene.GetComponent<SessionComponent>().Session?.Dispose();
         }
 

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

@@ -95,7 +95,7 @@ namespace ET
             {
                 zoneScene.AddComponent<SessionComponent>();
             }
-            zoneScene.GetComponent<SessionComponent>().Session = accountSession;
+            zoneScene.GetComponent<SessionComponent>().AccountSession = accountSession;
             accountSession.AddComponent<PingComponent>();
             accountSession.AddComponent<DisConnectedCompnent>();
             AccountInfoComponent accountInfoComponent = zoneScene.GetComponent<AccountInfoComponent>();
@@ -138,7 +138,7 @@ namespace ET
 
             try
             {
-                a2C_GetServerInfos = (A2C_GetServerInfos)await zoneScene.GetComponent<SessionComponent>().Session.Call(new C2A_GetServerInfos()
+                a2C_GetServerInfos = (A2C_GetServerInfos)await zoneScene.GetComponent<SessionComponent>().AccountSession?.Call(new C2A_GetServerInfos()
                 {
                     AccountId = zoneScene.GetComponent<AccountInfoComponent>().AccountId,
                     Token = zoneScene.GetComponent<AccountInfoComponent>().Token
@@ -173,7 +173,7 @@ namespace ET
 
             try
             {
-                a2C_GetRoles = (A2C_GetRoles)await zoneScene.GetComponent<SessionComponent>().Session.Call(new C2A_GetRoles()
+                a2C_GetRoles = (A2C_GetRoles)await zoneScene.GetComponent<SessionComponent>().AccountSession?.Call(new C2A_GetRoles()
                 {
                     AccountId = zoneScene.GetComponent<AccountInfoComponent>().AccountId,
                     Token = zoneScene.GetComponent<AccountInfoComponent>().Token,
@@ -208,7 +208,7 @@ namespace ET
             A2C_CreateRole a2C_CreateRole = null;
             try
             {
-                a2C_CreateRole = (A2C_CreateRole)await zoneScene.GetComponent<SessionComponent>().Session.Call(new C2A_CreateRole
+                a2C_CreateRole = (A2C_CreateRole)await zoneScene.GetComponent<SessionComponent>().AccountSession?.Call(new C2A_CreateRole
                 {
                     AccountId = zoneScene.GetComponent<AccountInfoComponent>().AccountId,
                     Token = zoneScene.GetComponent<AccountInfoComponent>().Token,
@@ -241,7 +241,7 @@ namespace ET
 
             try
             {
-                a2C_DeleteRole = (A2C_DeleteRole)await zoneScene.GetComponent<SessionComponent>().Session.Call(new C2A_DeleteRole()
+                a2C_DeleteRole = (A2C_DeleteRole)await zoneScene.GetComponent<SessionComponent>().AccountSession?.Call(new C2A_DeleteRole()
                 {
                     AccountId = zoneScene.GetComponent<AccountInfoComponent>().AccountId,
                     Token = zoneScene.GetComponent<AccountInfoComponent>().Token,
@@ -274,7 +274,7 @@ namespace ET
 
             try
             {
-                a2C_GetRealmKey = (A2C_GetRealmKey)await zoneScene.GetComponent<SessionComponent>().Session.Call(new C2A_GetRealmKey()
+                a2C_GetRealmKey = (A2C_GetRealmKey)await zoneScene.GetComponent<SessionComponent>().AccountSession?.Call(new C2A_GetRealmKey()
                 {
                     AccountId = zoneScene.GetComponent<AccountInfoComponent>().AccountId,
                     Token = zoneScene.GetComponent<AccountInfoComponent>().Token,
@@ -395,7 +395,7 @@ namespace ET
             A2C_GetLatestNotice response = null;
             try
             {
-                response = (A2C_GetLatestNotice)await GameGlobal.zoneScene.GetComponent<SessionComponent>().Session.Call(new C2A_GetLatestNotice());
+                response = (A2C_GetLatestNotice)await GameGlobal.zoneScene.GetComponent<SessionComponent>().AccountSession?.Call(new C2A_GetLatestNotice());
             }
             catch (Exception e)
             {

+ 5 - 2
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Session/SessionComponentSystem.cs

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

+ 1 - 0
GameClient/Assets/Game/HotUpdate/ETCodes/Model/App/Session/SessionComponent.cs

@@ -2,6 +2,7 @@
 {
 	public class SessionComponent: Entity, IAwake, IDestroy
 	{
+		public Session AccountSession;
 		public Session Session;
 	}
 }