From aca798172c07f1ca08f4599ad63eef67afc57665 Mon Sep 17 00:00:00 2001 From: NguyenVanDat Date: Tue, 28 Oct 2025 10:31:28 +0700 Subject: [PATCH] testfast --- .../Boostrap/BoostrapSceneController.cs | 4 + .../PerfectWorld/Scripts/Move/CECHostMove.cs | 6 +- Assets/PerfectWorld/Scripts/NPC/CECNPC.cs | 6 +- .../Scripts/Network/CSNetwork/GameSession.cs | 2 +- .../Scripts/UI/Login/LoginScreenUI.cs | 35 +- Assets/Prefabs/BoostrapForTest.prefab | 517 ++++++++++++++++++ Assets/Prefabs/BoostrapForTest.prefab.meta | 7 + Assets/Prefabs/MonsterPrefab.prefab | 8 +- Assets/Scenes/WorldRender.unity | 4 +- Assets/Scenes/a61.unity | 4 +- Assets/Scripts/CECHostPlayer.cs | 11 +- .../LiberationSans SDF - Fallback.asset | 301 ++++++++-- ProjectSettings/GraphicsSettings.asset | 2 +- 13 files changed, 852 insertions(+), 55 deletions(-) create mode 100644 Assets/Prefabs/BoostrapForTest.prefab create mode 100644 Assets/Prefabs/BoostrapForTest.prefab.meta diff --git a/Assets/PerfectWorld/Scripts/Boostrap/BoostrapSceneController.cs b/Assets/PerfectWorld/Scripts/Boostrap/BoostrapSceneController.cs index 668a6dd21d..9b9882fe21 100644 --- a/Assets/PerfectWorld/Scripts/Boostrap/BoostrapSceneController.cs +++ b/Assets/PerfectWorld/Scripts/Boostrap/BoostrapSceneController.cs @@ -17,7 +17,11 @@ namespace BrewMonster private void LoadNextScene() { +#if TESTFAST + SceneManager.LoadSceneAsync(_nextSceneName,LoadSceneMode.Additive); +#else SceneManager.LoadScene(_nextSceneName); +#endif } } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs b/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs index 46e401f0b8..853e802257 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECHostMove.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.Runtime.ConstrainedExecution; using System.Security.Cryptography; using System.Text; +using BrewMonster; using UnityEngine; public class CECHostMove @@ -144,6 +145,7 @@ public class CECHostMove } public void SendMoveCmd(in Vector3 vCurPos, in Vector3 vVel, int iMoveMode, bool bForceSend = false) { + Vector3 vMoveDir = vVel; float fSpeed = vMoveDir.magnitude; SendMoveCmd(vCurPos, fSpeed, iMoveMode, bForceSend); @@ -168,7 +170,7 @@ public class CECHostMove void SendMoveCmd(in Vector3 vCurPos, float fSpeed, int iMoveMode, bool bForceSend) { - + BMLogger.LogError($"HoangDev: m_bStop:{m_bStop}, cmdmovedelayCounter:{cmdmovedelayCounter}, bForceSend:{bForceSend}"); if (m_bStop) { // m_CmdTimeCnt.Reset(); @@ -179,6 +181,7 @@ public class CECHostMove return; int iTime = (int)(m_fMoveTime * 1000); + BMLogger.LogError($"HoangDev: iTime:{iTime},m_fMoveTime:{m_fMoveTime}"); if (iTime < 200) { @@ -197,6 +200,7 @@ public class CECHostMove m_fMoveTime = 0.0f; iMoveMode |= (int)GPMoveMode.GP_MOVE_DEAD; + BMLogger.LogError($"HoangDev: vCurPos:{vCurPos}, fSpeed:{fSpeed}, iMoveMode:{iMoveMode}"); UnityGameSession.Instance.c2s_CmdPlayerMove(vCurPos, vCurPos, iTime/* MOVECMD_INTERVAL */, fSpeed, iMoveMode, m_wMoveStamp++); m_vLastSevPos = vCurPos; diff --git a/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs b/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs index c9ffcf2193..69bb49d6f9 100644 --- a/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs +++ b/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs @@ -791,13 +791,15 @@ public class CECNPC : CECObject BMLogger.LogError($" CECNPC.QueueLoadNPCModel szModelFile= {szModelFile.ToLower()} "); var model = NPCBuilder.Instance.GetModelByPath(szModelFile.ToLower()); if (model == null) { + + model = GameObject.CreatePrimitive(PrimitiveType.Capsule); BMLogger.LogError($" CECNPC.QueueLoadNPCModel model == null szModelFile= {szModelFile} "); - return; } + } var monsterModel = Instantiate(model, transform); monsterModel.SetActive(true); var npcVisual = GetComponent(); - npcVisual.InitNPCEventDoneHandler(m_NPCInfo); + npcVisual?.InitNPCEventDoneHandler(m_NPCInfo); //QueueECModelForLoad(MTL_ECM_NPC, GetNPCInfo().nid, GetBornStamp(), GetServerPos(), szModelFile, tid); } diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index 671afb6aa4..28a4e43a74 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -338,7 +338,7 @@ namespace CSNetwork //sss //BMLogger.LogError($"### GameDataSend: CMDID {pCmdHeader}"); int iHostID = _selectedRole.roleid; - BMLogger.LogError($"### GameDataSend: " + pCmdHeader); + // BMLogger.LogError($"### GameDataSend: " + pCmdHeader); switch (pCmdHeader) { diff --git a/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs b/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs index 0089bebc45..c61a5b4e76 100644 --- a/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs +++ b/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs @@ -55,6 +55,7 @@ namespace BrewMonster.UI _usernameInputField.text = "test004"; _passwordInputField.text = "123456"; } + if (Input.GetKeyUp(KeyCode.Tab)) { _usernameInputField.text = "test002"; @@ -74,7 +75,7 @@ namespace BrewMonster.UI PlayerPrefs.SetString("password", password); PlayerPrefs.Save(); await UnityGameSession.Login(username, password, OnLoginComplete); - _selectCharacterScreen.gameObject.SetActive(true); + _selectCharacterScreen.gameObject.SetActive(true); } /// @@ -88,6 +89,7 @@ namespace BrewMonster.UI BMLogger.LogError("Login failed"); return; } + UnityGameSession.GetRoleListAsync(OnGetRoleListComplete); } @@ -110,7 +112,7 @@ namespace BrewMonster.UI private void OnSelectRoleComplete(RoleInfo roleInfo) { - context.Post(_ => + context.Post(_ => { isDoneWorldRender = false; isDoneNPCRender = false; @@ -121,7 +123,19 @@ namespace BrewMonster.UI return; } }; - string nameScene = "NPCRender"; +#if TESTFAST + string nameScene = "LoginScene"; + SceneManager.UnloadSceneAsync(nameScene); + nameScene = "NPCRender"; + UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Additive, (value) => + { + isDoneNPCRender = value; + isDoneWorldRender = value; + actLoadChar?.Invoke(); + UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete); + }); +#else + string nameScene = "NPCRender"; UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Single, (value) => { isDoneNPCRender = value; @@ -135,15 +149,18 @@ namespace BrewMonster.UI UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete); }); +#endif }, null); - } private async void OnEnterWorldComplete() { await Task.Delay(2000); // Request all known packages: 0=Inventory,1=Equipment,2=Task - UnityGameSession.RequestAllInventoriesAsync(() => { /*BMLogger.Log("Sent Inventory Detail Requests (all packs)");*/ }, 0, 1, 2); + UnityGameSession.RequestAllInventoriesAsync(() => + { + /*BMLogger.Log("Sent Inventory Detail Requests (all packs)");*/ + }, 0, 1, 2); UnityGameSession.RequestCheckSecurityPassWd(""); UnityGameSession.RequesrQueryPlayerCash(); await Task.Delay(2000); @@ -156,7 +173,7 @@ namespace BrewMonster.UI // _inventoryUI.DisplayInventory(inventoryData); //} - #if UNITY_EDITOR +#if UNITY_EDITOR private void OnValidate() { if (_usernameInputField == null) @@ -164,17 +181,19 @@ namespace BrewMonster.UI // find childrend with name "username" _usernameInputField = transform.Find("username").GetComponent(); } + if (_passwordInputField == null) { // find childrend with name "password" _passwordInputField = transform.Find("password").GetComponent(); } + if (_loginButton == null) { // find childrend with name "LoginBtn" _loginButton = transform.Find("LoginBtn").GetComponent