瀏覽代碼

返回游戏登录

guodong 3 年之前
父節點
當前提交
776c55bf7f

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

@@ -143,6 +143,7 @@ namespace GFGGame
             {
                 ViewManager.Show<LoginInputView>();
             }
+            LoginController.Logout();
         }
 
         //注销

+ 13 - 2
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs

@@ -23,7 +23,7 @@ namespace GFGGame
         {
             ViewManager.Show<ModalStatusView>("登录中...");
             int errorCode = await ET.LoginHelper.Login(GameGlobal.zoneScene, ET.ConstValue.LoginAddress, account, password, isMD5);
-            ViewManager.Hide<ModalStatusView>();
+            
             if (errorCode == ET.ErrorCode.ERR_Success)
             {
                 GameGlobal.isVisitor = false;
@@ -55,6 +55,7 @@ namespace GFGGame
             }
             else
             {
+                ViewManager.Hide<ModalStatusView>();
                 if (ErrorCodeController.Handler(errorCode))
                 {
                     ViewManager.Show<LoginInputView>();
@@ -62,17 +63,23 @@ namespace GFGGame
             }
         }
 
+        public static void Logout()
+        {
+            GameGlobal.zoneScene.GetComponent<SessionComponent>().Session?.Dispose();
+        }
+
         public static async ETTask Register(string account, string password, string name, string identityNum, string code)
         {
             ViewManager.Show<ModalStatusView>("注册中...");
             int errorCode = await LoginHelper.Register(GameGlobal.zoneScene, ET.ConstValue.LoginAddress, account, password, name, identityNum, code);
-            ViewManager.Hide<ModalStatusView>();
+            
             if (errorCode == ErrorCode.ERR_Success)
             {
                 Login(account, password).Coroutine();
             }
             else
             {
+                ViewManager.Hide<ModalStatusView>();
                 ErrorCodeController.Handler(errorCode);
             }
         }
@@ -118,15 +125,18 @@ namespace GFGGame
             }
             else
             {
+                ViewManager.Hide<ModalStatusView>();
                 GameController.ShowCreateRole();
             }
         }
 
         public static async ETTask ReqCreateRole(string roleName)
         {
+            ViewManager.Show<ModalStatusView>("创建角色中...");
             int errorCode = await ET.LoginHelper.CreateRole(GameGlobal.zoneScene, roleName);
             if (errorCode != ErrorCode.ERR_Success)
             {
+                ViewManager.Hide<ModalStatusView>();
                 ErrorCodeController.Handler(errorCode);
                 return;
             }
@@ -157,6 +167,7 @@ namespace GFGGame
                 return;
             }
             await GameController.PreEnterGameAsync();
+            ViewManager.Hide<ModalStatusView>();
         }
     }
 }

+ 2 - 2
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/ConstValue.cs

@@ -2,7 +2,7 @@
 {
     public static class ConstValue
     {
-        public const string LoginAddress = "10.108.64.190:10005";
-        //  public const string LoginAddress = "127.0.0.1:10005";
+        //public const string LoginAddress = "10.108.64.190:10005";
+          public const string LoginAddress = "127.0.0.1:10005";
     }
 }