From 24540e150d55842790abdcdedcc56fcd0430090a Mon Sep 17 00:00:00 2001 From: HungDK <> Date: Tue, 16 Sep 2025 15:33:15 +0700 Subject: [PATCH] Fixing func calling order --- .../Scripts/Network/UnityGameSession.cs | 14 +++---------- .../Scripts/UI/Login/LoginScreenUI.cs | 20 ++++--------------- Assets/Scripts/GameController.cs | 11 ---------- 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs index 0accc12502..f7b465f98a 100644 --- a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs @@ -1,7 +1,6 @@ using BrewMonster; using CSNetwork; using CSNetwork.Protocols; -using CSNetwork.C2SCommand; using CSNetwork.Protocols.RPCData; using CSNetwork.Security; using System; @@ -122,16 +121,9 @@ namespace BrewMonster.Network { Instance._gameSession.SendChatData(cChannel, szMsg, iPack, iSlot); } - public static void RequestInventoryAsync(Action callback = null) + public static void RequestInventoryAsync(byte byPackage, Action callback = null) { - Instance._gameSession.RequestInventoryAsync(callback); - } - - public static void RequestInventoryByPackageAsync(byte byPackage, Action callback = null) - { - var req = new gamedatasend(); - req.Data = C2SCommandFactory.CreateGetInventoryDetail(byPackage); - SendProtocol(req, callback); + Instance._gameSession.RequestInventoryAsync(byPackage, callback); } public static void RequestAllInventoriesAsync(Action callback = null, params byte[] packages) @@ -153,7 +145,7 @@ namespace BrewMonster.Network foreach (var p in packages) { - RequestInventoryByPackageAsync(p, onOneDone); + RequestInventoryAsync(p, onOneDone); } } diff --git a/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs b/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs index 44bc24c464..f140c0333b 100644 --- a/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs +++ b/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs @@ -99,20 +99,6 @@ namespace BrewMonster.UI { return; } - - // now we have to enter the world - UnityGameSession.SendProtocol( - new enterworld() - { - Roleid = roleInfo.roleid, - Provider_link_id = 0, - L_timeout = 0, - Localsid = 0, - Locktime = 0, - Settime = 0, - Timeout = 0 - } - ); }; string nameScene = "NPCRender"; UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Single, (value) => @@ -125,9 +111,11 @@ namespace BrewMonster.UI { isDoneWorldRender = value; actLoadChar?.Invoke(); + UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete); + }); - }, null); - OnEnterWorldComplete(); + }, null); + } private async void OnEnterWorldComplete() diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index 1661b6c4e1..ace92d1263 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -20,12 +20,6 @@ public class GameController : MonoBehaviour if (instance == null) { instance = FindAnyObjectByType(); - //if (instance == null) - //{ - // var go = new GameObject("GameController"); - // instance = go.AddComponent(); - // DontDestroyOnLoad(go); - //} } return instance; } @@ -35,12 +29,7 @@ public class GameController : MonoBehaviour if(instance == null) { instance = this; - //DontDestroyOnLoad(gameObject); } - //else if(instance != this) - //{ - // Destroy(gameObject); - //} } private void Start()