hexiaojie 7 bulan lalu
induk
melakukan
bca25021ba

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

@@ -1,4 +1,5 @@
-using ET;
+using System;
+using ET;
 using UnityEngine;
 
 namespace GFGGame
@@ -35,7 +36,7 @@ namespace GFGGame
                 LocalCache.SetBool(GameConst.LAST_LOGIN_IS_VISITOR_KEY, GameGlobal.isVisitor);
                 PlayerPrefs.Save();
 
-                await OnLoginSuccess();
+                await OnLoginSuccess(null);
             }
             else
             {
@@ -79,7 +80,7 @@ namespace GFGGame
                 GameController.CheckSpecialAccount(account);
                 LocalCache.SetBool(GameConst.LAST_LOGIN_IS_VISITOR_KEY, GameGlobal.isVisitor);
                 PlayerPrefs.Save();
-                await OnLoginSuccess();
+                await OnLoginSuccess(null);
             }
             else
             {
@@ -87,9 +88,10 @@ namespace GFGGame
             }
         }
 
-        public static async ETTask OnLoginSuccess()
+        public static async ETTask OnLoginSuccess(Action<bool> action)
         {
             await GetServerInfos();
+            action?.Invoke(true);
             ServerInfosComponent serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
             EventAgent.DispatchEvent(ConstMessage.SERVER_CHANGE, serverInfosComponent.CurrentServerId);
             EventAgent.DispatchEvent(ConstMessage.LOGIN_SUCCESS);
@@ -289,6 +291,7 @@ namespace GFGGame
                 ErrorCodeController.Handler(errorCode);
                 return;
             }
+
             errorCode = await LoginHelper.EnterGame(GameGlobal.zoneScene);
             if (errorCode != ErrorCode.ERR_Success)
             {
@@ -306,7 +309,7 @@ namespace GFGGame
             AlertSystem.Hide();
             await GameController.PreEnterGameAsync();
             LogServerHelper.SendNodeLog((int)LogNode.OnEnterGame);
-            
+
             // CommonDataManager.InitAllAsync(async () =>
             // {
             //

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

@@ -46,45 +46,6 @@ namespace ET
             return (ErrorCode.ERR_Success, 0);
         }
 
-        public static async ETTask<(int, long)> LoginTest(Scene zoneScene, string address, string account,
-            bool cancelDelete)
-        {
-            A2C_LoginAccount a2CLoginAccount = null;
-            Session accountSession = null;
-            try
-            {
-                Debug.Log($"address:{address}");
-                accountSession = zoneScene.GetComponent<NetWSComponent>()
-                    .Create(null, address);
-
-                a2CLoginAccount = (A2C_LoginAccount)await accountSession.Call(new C2A_LoginTest()
-                {
-                    Account = account,
-                    Version = GameConst.SERVER_VERSION,
-                    PlatformId = LauncherConfig.platformId,
-                    ChannelId = LauncherConfig.ChannelId,
-                    CancelDelete = cancelDelete,
-                    Token = ""
-                });
-            }
-            catch (Exception e)
-            {
-                //accountSession?.Dispose();
-                Log.Debug("打印报错:" + e.ToString());
-                return (ErrorCode.ERR_NetWorkError, 0);
-            }
-
-            if (a2CLoginAccount.Error != ErrorCode.ERR_Success)
-            {
-                //accountSession?.Dispose();
-                return (a2CLoginAccount.Error, a2CLoginAccount.DeleteTime);
-            }
-
-            OnLoginSuccess(zoneScene, a2CLoginAccount, accountSession, account);
-
-            return (ErrorCode.ERR_Success, 0);
-        }
-
         public static async ETTask<(int, long)> Login(Scene zoneScene, string address, string account, string password,
             bool isMD5, bool cancelDelete)
         {
@@ -141,6 +102,7 @@ namespace ET
             accountInfoComponent.AccountId = a2CLoginAccount.AccountId;
             accountInfoComponent.Account = account;
             accountInfoComponent.Age = a2CLoginAccount.Age;
+            GameGlobal.userAge =  a2CLoginAccount.Age;
         }
 
         public static async ETTask<int> Register(Scene zoneScene, string address, string account, string password,

+ 1 - 1
GameClient/Assets/Game/HotUpdate/GameConfig.cs

@@ -33,7 +33,7 @@ namespace GFGGame
             LoginAddress = result.loginApiUrl;
             //LoginAddress = "43.139.184.240:10003";
             //LoginAddress = "129.204.4.238:11005";//测试地址
-            LoginAddress = "192.168.1.2:10005";//测试地址       
+            //LoginAddress = "192.168.1.2:10005";//测试地址       
             showGM = int.Parse(result.showGM);
             if(!string.IsNullOrEmpty(result.openTime))
             {

+ 1 - 1
GameClient/Assets/Game/HotUpdate/NetworkTCP/WChannel_WebGL.cs

@@ -24,7 +24,7 @@ namespace ET
             this.ChannelType = ChannelType.Connect;
             this.Id = id;
 
-            string wsStr = $"ws://192.168.1.2:10005";
+            string wsStr = $"ws://{ipEndPoint}";
 
             Log.Debug($"wc address:{address}");
             if (LauncherConfig.isHttps)

+ 10 - 8
GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs

@@ -97,9 +97,6 @@ namespace GFGGame
 
         private void ContinueAfterSceneLoad()
         {
-            ServerInfosComponent serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
-            ServerInfo recentlyServerInfo = serverInfosComponent.recentlyServerInfo;
-            UpdateServer(recentlyServerInfo);
             _ui.m_btnAgree.selected = LocalCache.GetBool(GameConst.LAST_LOGIN_IS_VISITOR_KEY, false);
             _ui.m_btnAgree.selected = true;
 
@@ -121,7 +118,13 @@ namespace GFGGame
             if (!autoLogined)
             {
                 autoLogined = true;
-                TryLogin();
+                TryLogin(a =>
+                {
+                    ServerInfosComponent serverInfosComponent =
+                        GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
+                    ServerInfo recentlyServerInfo = serverInfosComponent.recentlyServerInfo;
+                    UpdateServer(recentlyServerInfo);
+                });
             }
         }
 
@@ -195,7 +198,7 @@ namespace GFGGame
         }
 
 
-        private void TryLogin()
+        private void TryLogin(Action<bool> action)
         {
             var url = LauncherConfig.cfgUrl.Replace("{cfgName}", LauncherConfig.cfgName);
             url = url + "?t=" + DateTime.Now.Ticks;
@@ -220,12 +223,11 @@ namespace GFGGame
                     PromptController.Instance.ShowFloatTextPrompt("请仔细阅读并同意游戏用户协议、隐私保护指引、儿童隐私政策");
                     return;
                 }
-
-
+                
                 LoginHelper.H5Login(GameGlobal.zoneScene, GameConfig.LoginAddress,
                     error =>
                     {
-                        LoginController.OnLoginSuccess().Coroutine();
+                        LoginController.OnLoginSuccess(action).Coroutine();
                         _ui.m_btnStart.visible = true;
                         _ui.m_btnStart.text = "开始游戏";
                     }).Coroutine();

+ 1 - 0
GameClient/GameClient.sln.DotSettings.user

@@ -1,4 +1,5 @@
 <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAction_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3789ee403a53437cbb6b5d9ab6311f51573620_003F81_003F60297759_003FAction_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAction_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F695d1cc93cca45069c528c15c9fdd7493e2800_003F01_003F46970b32_003FAction_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AActivator_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3789ee403a53437cbb6b5d9ab6311f51573620_003F56_003F27c54aae_003FActivator_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AActivator_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F695d1cc93cca45069c528c15c9fdd7493e2800_003F20_003F3a0a5fc0_003FActivator_002Ecs_002Fz_003A2_002D1/@EntryIndexedValue">ForceIncluded</s:String>