diff --git a/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset b/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset index d09ad64c47..88bf6dffcb 100644 --- a/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset +++ b/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset @@ -45,6 +45,11 @@ MonoBehaviour: m_ReadOnly: 0 m_SerializedLabels: [] FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: a81dab17b00ef4b4494a71ee88b10cc0 + m_Address: "\u7A0B\u5E8F\u8054\u5165/\u89D2\u8272\u5347\u7EA7\u4EBA\u7C7B.gfx" + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 m_ReadOnly: 0 m_Settings: {fileID: 11400000, guid: 070edb522e6e54c14a99055900003890, type: 2} m_SchemaSet: diff --git a/Assets/PerfectWorld/Scripts/Managers/A3DTerrain2.cs b/Assets/PerfectWorld/Scripts/Managers/A3DTerrain2.cs index e78f6de794..60edeb0c77 100644 --- a/Assets/PerfectWorld/Scripts/Managers/A3DTerrain2.cs +++ b/Assets/PerfectWorld/Scripts/Managers/A3DTerrain2.cs @@ -1,6 +1,4 @@ -using BrewMonster.Scripts.Player; using CSNetwork.GPDataType; -using NUnit.Framework; using PerfectWorld.Scripts.Player; using System.Collections.Generic; using System.Linq; diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_HPWork.cs b/Assets/PerfectWorld/Scripts/Managers/EC_HPWork.cs index be174ba59e..957e991c73 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_HPWork.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_HPWork.cs @@ -1,5 +1,4 @@ using BrewMonster.Network; -using BrewMonster.Scripts.Player; using System.Collections.Generic; namespace BrewMonster.Scripts @@ -479,11 +478,22 @@ namespace BrewMonster.Scripts } public void StartDelayedWork() { - + if (!HasDelayedWork()){ + return; + } + CECHPWork pWork = m_Delayed.pWork; + m_Delayed.pWork = null; + // LOG_DEBUG_INFO(AString().Format("CECHPWork:: start delayed work %s, priority=%d", pWork->GetWorkName(), m_Delayed.iPriority)); + InternallyStartWork(m_Delayed.iPriority, pWork); } public void ClearDelayedWork() { - + if (!HasDelayedWork()){ + return; + } + // LOG_DEBUG_INFO(AString().Format("delayed CECHPWork::%s priority=%d cleared", m_Delayed.pWork->GetWorkName(), m_Delayed.iPriority)); + // delete m_Delayed.pWork; + m_Delayed.pWork = null; } public CECHPWork GetDelayedWork() { @@ -742,6 +752,10 @@ namespace BrewMonster.Scripts { return IsWorkRunning(CECHPWork.Host_work_ID.WORK_PICKUP); } + private bool HasDelayedWork() + { + return GetDelayedWork() != null; + } } public abstract class CECHPWorkPostTickCommand { diff --git a/Assets/PerfectWorld/Scripts/Managers/aabbcd.cs b/Assets/PerfectWorld/Scripts/Managers/aabbcd.cs index 33c2b0852c..7ce9609e73 100644 --- a/Assets/PerfectWorld/Scripts/Managers/aabbcd.cs +++ b/Assets/PerfectWorld/Scripts/Managers/aabbcd.cs @@ -1,5 +1,4 @@ using CSNetwork.GPDataType; -using BrewMonster.Scripts.Player; using PerfectWorld.Scripts.Player; namespace BrewMonster.Scripts diff --git a/Assets/PerfectWorld/Scripts/Move/EC_CDR.cs b/Assets/PerfectWorld/Scripts/Move/EC_CDR.cs index c5f4b24a68..858636966c 100644 --- a/Assets/PerfectWorld/Scripts/Move/EC_CDR.cs +++ b/Assets/PerfectWorld/Scripts/Move/EC_CDR.cs @@ -1,6 +1,4 @@ -using BrewMonster.Scripts.Ornament; -using BrewMonster.Scripts.Player; -using BrewMonster.Scripts.World; +using BrewMonster.Scripts.World; using CSNetwork.GPDataType; using System; using UnityEngine; diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index 240b440830..c42ac6d077 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -2,7 +2,6 @@ using BrewMonster.Assets.PerfectWorld.Scripts.UI; using BrewMonster.Managers; using BrewMonster.Network; -using BrewMonster.Scripts.Player; using BrewMonster.Scripts.Skills; using CSNetwork.C2SCommand; using CSNetwork.GPDataType; diff --git a/Assets/PerfectWorld/Scripts/PlayerState.meta b/Assets/PerfectWorld/Scripts/PlayerState.meta deleted file mode 100644 index 5e82186982..0000000000 --- a/Assets/PerfectWorld/Scripts/PlayerState.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9ef8d28320e272c47b341e1a2aca2ff5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/PerfectWorld/Scripts/PlayerState/PlayerIdleState.cs b/Assets/PerfectWorld/Scripts/PlayerState/PlayerIdleState.cs deleted file mode 100644 index d04a730cd8..0000000000 --- a/Assets/PerfectWorld/Scripts/PlayerState/PlayerIdleState.cs +++ /dev/null @@ -1,28 +0,0 @@ -using BrewMonster.Scripts.Player; -using UnityEngine; -using static CECPlayer; - -namespace BrewMonster -{ - public class PlayerIdleState : PlayerState - { - public PlayerIdleState(CECHostPlayer characterCtrl) : base(characterCtrl) - { - } - - public override void Enter() - { - _characterCtrl.PlayAction((int)PLAYER_ACTION_TYPE.ACT_STAND, true, 1, false); - } - - public override void Exit() - { - - } - - public override void Update() - { - _characterCtrl.HandleMovement(); - } - } -} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/PlayerState/PlayerIdleState.cs.meta b/Assets/PerfectWorld/Scripts/PlayerState/PlayerIdleState.cs.meta deleted file mode 100644 index 7941cfe01f..0000000000 --- a/Assets/PerfectWorld/Scripts/PlayerState/PlayerIdleState.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 89482cfe1c5315b4d833133e919eac40 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/PlayerState/PlayerMoveState.cs b/Assets/PerfectWorld/Scripts/PlayerState/PlayerMoveState.cs deleted file mode 100644 index 5db592893c..0000000000 --- a/Assets/PerfectWorld/Scripts/PlayerState/PlayerMoveState.cs +++ /dev/null @@ -1,29 +0,0 @@ -using BrewMonster.Scripts.Player; -using UnityEngine; -using static CECPlayer; - -namespace BrewMonster -{ - public class PlayerMoveState : PlayerState - { - public PlayerMoveState(CECHostPlayer characterCtrl) : base(characterCtrl) - { - } - - public override void Enter() - { - _characterCtrl.PlayAction((int)PLAYER_ACTION_TYPE.ACT_RUN, true, 1, false); - } - - public override void Exit() - { - _characterCtrl.StopMovement(); - } - - public override void Update() - { - _characterCtrl.HandleMovement(); - } - - } -} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/PlayerState/PlayerMoveState.cs.meta b/Assets/PerfectWorld/Scripts/PlayerState/PlayerMoveState.cs.meta deleted file mode 100644 index 1ee3be87e9..0000000000 --- a/Assets/PerfectWorld/Scripts/PlayerState/PlayerMoveState.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 979df0dcb6a16cf47a77106a9c9ebb8f \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/PlayerState/PlayerState.cs b/Assets/PerfectWorld/Scripts/PlayerState/PlayerState.cs deleted file mode 100644 index 2733c8dfd4..0000000000 --- a/Assets/PerfectWorld/Scripts/PlayerState/PlayerState.cs +++ /dev/null @@ -1,16 +0,0 @@ -using UnityEngine; - -namespace BrewMonster -{ - public abstract class PlayerState - { - protected readonly CECHostPlayer _characterCtrl; - public PlayerState(CECHostPlayer characterCtrl) - { - _characterCtrl = characterCtrl; - } - public abstract void Enter(); - public abstract void Exit(); - public abstract void Update(); - } -} diff --git a/Assets/PerfectWorld/Scripts/PlayerState/PlayerState.cs.meta b/Assets/PerfectWorld/Scripts/PlayerState/PlayerState.cs.meta deleted file mode 100644 index 037ea5a784..0000000000 --- a/Assets/PerfectWorld/Scripts/PlayerState/PlayerState.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 1c3e8f4466ed88340aeb27f86dc0c172 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs index 73221fb451..2698055ebc 100644 --- a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs @@ -1,11 +1,7 @@ using BrewMonster.Network; -using BrewMonster.Scripts.Managers; -using BrewMonster.Scripts.Player; using CSNetwork.GPDataType; using PerfectWorld.Scripts.Task; -using System; using System.Collections.Generic; -using System.IO; using System.Runtime.InteropServices; using CSNetwork; using UnityEngine; diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 922be30616..d63684f994 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -1,11 +1,9 @@ -using BrewMonster; -using BrewMonster.Assets.PerfectWorld.Scripts.Players; +using BrewMonster.Assets.PerfectWorld.Scripts.Players; using BrewMonster.Managers; using BrewMonster.Network; using BrewMonster.PerfectWorld.Scripts.Vfx; using BrewMonster.Scripts; using BrewMonster.Scripts.Managers; -using BrewMonster.Scripts.Player; using BrewMonster.Scripts.Skills; using CSNetwork; using CSNetwork.GPDataType; @@ -33,9 +31,6 @@ namespace BrewMonster [SerializeField] private Button btnJump; [SerializeField] private Button btnRun; - private PlayerStateMachine _playerStateMachine; - private PlayerMoveState _moveState; - // private PlayerIdleState _idleState; public CECHostMove m_MoveCtrl; private CECHPWorkMan m_pWorkMan; // Host work manager @@ -164,9 +159,6 @@ namespace BrewMonster private void Awake() { base.Awake(); - _moveState = new PlayerMoveState(this); - // _idleState = new PlayerIdleState(this); - _playerStateMachine = new PlayerStateMachine(); m_MoveCtrl = new CECHostMove(this); // Cache: không bắt buộc, nhưng gọn tay và ít gọi property lặp. @@ -240,8 +232,6 @@ namespace BrewMonster { mainCam = FindFirstObjectByType(); } - - // _playerStateMachine.InitState(_idleState); // btnJump.onClick.AddListener(HandleJump); // Cache input devices for better performance @@ -263,8 +253,7 @@ namespace BrewMonster m_MoveCtrl.Tick((ulong)(Time.deltaTime * 1000)); // Nếu có thay đổi runtime, có thể lấy lại mỗi vài giây/Start nếu bạn thích: // ccRadius = controller.radius; ccSkin = controller.skinWidth; - - _playerStateMachine.UpdateState(); + OnKeyDown(); m_pWorkMan?.Tick(Time.deltaTime); @@ -1079,49 +1068,48 @@ namespace BrewMonster public void OnMsgHstGoto(in ECMSG Msg) { - Debug.Log("HoangDev :OnMsgHstGoto"); PopupManager.Instance.OnPlayerRevived(); // p1 is a byte[] buffer; parse into cmd_notify_hostpos then set position byte[] buf = (byte[])Msg.dwParam1; cmd_notify_hostpos pCmd = GPDataTypeHelper.FromBytes(buf); SetPos(new Vector3(pCmd.vPos.x, pCmd.vPos.y, pCmd.vPos.z)); - } private void OnMsgHstStartAttack(in ECMSG Msg) { - // cmd_host_start_attack pCmd = (cmd_host_start_attack*)Msg.dwParam1; - // ASSERT(pCmd); - // - // // test code... - // // g_pGame.GetRTDebug().OutputNotifyMessage(RTDCOL_WARNING, _AL("start attack !")); - // - // // Check whether target is the one that we have selected - // if (m_idSelTarget != pCmd.idTarget) - // g_pGame.RuntimeDebugInfo(RTDCOL_WARNING, _AL("Target has changed !")); - // - // // If target turn to be un-attackable, cancel action - // if (!AttackableJudge(pCmd.idTarget, true)) - // { - // g_pGame.GetGameSession().c2s_CmdCancelAction(); - // g_pGame.RuntimeDebugInfo(RTDCOL_WARNING, _AL("Cannel attacking !")); - // return; - // } - // - // // Synchronize ammo amount - // CECIvtrItem* pItem = m_pEquipPack.GetItem(EQUIPIVTR_PROJECTILE); - // if (pItem) - // { - // if (!pCmd.ammo_remain) - // m_pEquipPack.SetItem(EQUIPIVTR_PROJECTILE, NULL); - // else - // pItem.SetAmount(pCmd.ammo_remain); - // } - // - // CECHPWorkMelee* pWork = (CECHPWorkMelee*)m_pWorkMan.CreateWork(CECHPWork::WORK_HACKOBJECT); - // m_pWorkMan.StartWork_p1(pWork); - // - // m_bMelee = true; + cmd_host_start_attack pCmd = GPDataTypeHelper.FromBytes((byte[])Msg.dwParam1); + + // ASSERT(pCmd); + + // test code... + // g_pGame.GetRTDebug().OutputNotifyMessage(RTDCOL_WARNING, _AL("start attack !")); + + // Check whether target is the one that we have selected + if (m_idSelTarget != pCmd.idTarget) + // g_pGame.RuntimeDebugInfo(RTDCOL_WARNING, _AL("Target has changed !")); + + // If target turn to be un-attackable, cancel action + if (AttackableJudge(pCmd.idTarget, true)==0) + { + UnityGameSession.c2s_CmdCancelAction(); + // g_pGame.RuntimeDebugInfo(RTDCOL_WARNING, _AL("Cannel attacking !")); + return; + } + + // Synchronize ammo amount + // CECIvtrItem* pItem = m_pEquipPack.GetItem(EQUIPIVTR_PROJECTILE); + // if (pItem) + // { + // if (!pCmd.ammo_remain) + // m_pEquipPack.SetItem(EQUIPIVTR_PROJECTILE, NULL); + // else + // pItem.SetAmount(pCmd.ammo_remain); + // } + + CECHPWorkMelee pWork = (CECHPWorkMelee)m_pWorkMan.CreateWork(Host_work_ID.WORK_HACKOBJECT); + m_pWorkMan.StartWork_p1(pWork); + + m_bMelee = true; // AP_ActionEvent(AP_EVENT_STARTMELEE); } @@ -1129,7 +1117,7 @@ namespace BrewMonster { // using namespace S2C; // - // m_bMelee = false; + m_bMelee = false; // // // if there is an attack event currently, we should let it fire now. ClearComActFlagAllRankNodes(true); @@ -1774,12 +1762,12 @@ namespace BrewMonster public bool IsPlayingAction(int iAction) { - if (iAction == (int)PLAYER_ACTION_TYPE.ACT_WALK && _playerStateMachine.State is PlayerMoveState) + if (iAction == (int)PLAYER_ACTION_TYPE.ACT_WALK )//&& _playerStateMachine.State is PlayerMoveState { return true; } - if (iAction == (int)PLAYER_ACTION_TYPE.ACT_STAND && _playerStateMachine.State is PlayerIdleState) + if (iAction == (int)PLAYER_ACTION_TYPE.ACT_STAND)// && _playerStateMachine.State is PlayerIdleState { return true; } @@ -2483,7 +2471,7 @@ namespace BrewMonster case ActionCanDo.CANDO_TRADE: - if (IsDead() /*|| IsAboutToDie() || IsSitting() */ || IsJumping() /*|| IsMeleeing() || + if (IsDead() || IsMeleeing() /*|| IsAboutToDie() || IsSitting() || IsJumping() || IsTrading() || IsUsingTrashBox() || IsTalkingWithNPC() || IsChangingFace() || IsSpellingMagic() || GetBoothState() != 0 || m_iBuddyId || IsOperatingPet() || IsRebuildingPet() || IsUsingItem() || IsInvisible() || IsPassiveMove()*/) @@ -2493,7 +2481,7 @@ namespace BrewMonster case ActionCanDo.CANDO_PLAYPOSE: - if (IsDead() /*|| IsAboutToDie() || IsSitting()*/ || IsJumping() || /* IsMeleeing() || + if (IsDead() || IsMeleeing() || /*|| IsAboutToDie() || IsSitting() || IsJumping() || /* || IsTrading() || IsUsingTrashBox() || IsTalkingWithNPC() || IsChangingFace() || IsSpellingMagic() || IsShapeChanged() || IsReviving() ||*/ m_iMoveEnv != (int)MoveEnvironment.MOVEENV_GROUND /*|| diff --git a/Assets/Scripts/PlayerStateMachine.cs b/Assets/Scripts/PlayerStateMachine.cs deleted file mode 100644 index aa6d7851da..0000000000 --- a/Assets/Scripts/PlayerStateMachine.cs +++ /dev/null @@ -1,44 +0,0 @@ -using UnityEngine; - -namespace BrewMonster.Scripts.Player -{ - public class PlayerStateMachine - { - PlayerState _state; - CECHostPlayer _characterCtrl; - - public PlayerState State { get => _state; } - - public void InitState(PlayerState state) - { - if (_state != null) - { - Debug.LogWarning("_state is already inited"); - return; - } - _state = state; - _state.Enter(); - } - - public void ChangeState(PlayerState state) - { - if (_state == null) - { - Debug.LogError("you need to init state first "); - return; - } - if (_state == state) - { - Debug.LogWarning("Unchanged state"); - } - _state.Exit(); - _state = state; - _state.Enter(); - } - public void UpdateState() - { - // _state.Update(); - } - - } -} diff --git a/Assets/Scripts/PlayerStateMachine.cs.meta b/Assets/Scripts/PlayerStateMachine.cs.meta deleted file mode 100644 index 1de8cadd00..0000000000 --- a/Assets/Scripts/PlayerStateMachine.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 99f098b6660da2c4f8ff06b5043a254b \ No newline at end of file diff --git a/Assets/Scripts/PlayerVisual.cs b/Assets/Scripts/PlayerVisual.cs index 6b75da9b3d..d5d4c8ea31 100644 --- a/Assets/Scripts/PlayerVisual.cs +++ b/Assets/Scripts/PlayerVisual.cs @@ -1,7 +1,5 @@ using Animancer; using BrewMonster; -using System; -using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; diff --git a/Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs b/Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs index 3da77b5774..c43290a0b3 100644 --- a/Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs +++ b/Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs @@ -1,5 +1,4 @@ using BrewMonster; -using BrewMonster.Scripts.Player; using UnityEngine; #if ENABLE_INPUT_SYSTEM using UnityEngine.InputSystem;