From 0dfff3a4ae37e50d839fcbc22103d2af469a811e Mon Sep 17 00:00:00 2001 From: Chomper9981 Date: Wed, 25 Mar 2026 11:19:48 +0700 Subject: [PATCH] Add animation for skill --- .../PerfectWorld/Scripts/GameData/ExpTypes.cs | 3 +- Assets/PerfectWorld/Scripts/Move/CECPlayer.cs | 35 ++++++++++--------- .../Scripts/UI/GamePlay/EC_GameUIMan.cs | 4 --- Assets/Scripts/EC_Utility.cs | 4 +-- Assets/Scripts/PlayerVisual.cs | 13 +++---- 5 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs index 327da33f03..d2c6fbce61 100644 --- a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs +++ b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs @@ -4756,7 +4756,8 @@ namespace BrewMonster [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public ushort[] name; // name, max 15 characters - public string Name => ByteToStringUtils.UshortArrayToCP936String(name); + public string Name => ByteToStringUtils.UshortArrayToUnicodeString(name); + //public string Name => ByteToStringUtils.UshortArrayToUnicodeString(name); [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] action_name; // action name, max 15 characters diff --git a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs index 275fa75ab8..28d912691e 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs @@ -1003,18 +1003,17 @@ namespace BrewMonster continue; data = (PLAYER_ACTION_INFO_CONFIG)dataman.get_data_ptr(id, ID_SPACE.ID_SPACE_CONFIG, ref dt); - if (!string.IsNullOrEmpty(data.ActionName) && data.ActionName[0] != '0') + if (!string.IsNullOrEmpty(data.ActionName)) { if (!actionMap.TryAdd(data.ActionName, data)) { } } - if (!string.IsNullOrEmpty(data.ActionName) && data.ActionName[0] != '0') + if (!string.IsNullOrEmpty(data.ActionName)) { if (!skillActionMap.TryAdd(data.Name, data)) - { - + { } } } @@ -1068,14 +1067,15 @@ namespace BrewMonster break; string skillName = ElementSkill.GetName(idSkill); - if (!string.IsNullOrEmpty(skillName)) { - if (skillActionMap.TryGetValue(skillName, out PLAYER_ACTION_INFO_CONFIG data1)) + var checkExist = skillActionMap.TryGetValue(skillName, out PLAYER_ACTION_INFO_CONFIG data1); + if (checkExist) { - // ✅ Gán dữ liệu hành động cho skill tương ứng - _default_skill_actions[idSkill] = data1; - + if(!_default_skill_actions.ContainsKey(idSkill)) + { + _default_skill_actions.Add(idSkill, data1); + } #if DEBUG_OUTPUT_ACTIONS for (int n = 0; n < PlayerSkillAction.NUM_WEAPON_TYPE; n++) { @@ -1499,7 +1499,7 @@ namespace BrewMonster } else { - attackerEvents.Signal(); + attackerEvents.Signal(); } } if (ElementSkill.IsGoblinSkill((uint)idSkill) && @@ -1524,6 +1524,7 @@ namespace BrewMonster && PlaySkillAttackAction(idSkill, nAttackSpeed, ref unusedInt, nSection, pAttack) && (dwModifier & (uint)MOD.MOD_BEAT_BACK) == 0) { + pAttack.m_bSignaled = true; } else { @@ -2100,30 +2101,32 @@ namespace BrewMonster m_pActionController.StopSkillCastAction(); } } - public bool PlaySkillCastAction(int idSkill) + public bool PlaySkillCastAction(int idSkill, CECAttackEvent attackEvent = null) { string szAct = ""; int weapon_type = GetShowingWeaponType(); + int moveEnv = GetMoveEnv(); if (!_default_skill_actions.TryGetValue((uint)idSkill, out PLAYER_ACTION_INFO_CONFIG data) || data.action_prefix == null || data.action_prefix.Length == 0 || data.action_prefix[0] == 0) { - // Check if it's a target item skill if (ElementSkill.GetCommonCoolDown((uint)idSkill) > 1 << 4) { data = m_PlayerActions[(int)PLAYER_ACTION_TYPE.ACT_USING_TARGET_ITEM].data; if (data.action_prefix == null || data.action_prefix.Length == 0 || data.action_prefix[0] == 0) + { return false; + } } else + { return false; + } } - - if (GetMoveEnv() == (int)MoveEnvironment.MOVEENV_GROUND) + if (moveEnv == (int)MoveEnvironment.MOVEENV_GROUND) { - szAct = EC_Utility.BuildActionName(data, weapon_type, "_Ò÷³ª_"); - BMLogger.LogError($"HoangDev: PlaySkillCastAction szAct={szAct} "); + szAct = EC_Utility.BuildActionName(data, weapon_type, "_吟唱_"); } else { diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs index 858975a766..ecb06b1f7f 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs @@ -345,10 +345,6 @@ namespace BrewMonster.UI m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_SKILL] = (SKILL_ICONLIST_NAME, Resources.LoadAll(SKILL_ICONLIST_NAME)); m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_ACTION] = (ACTION_ICONLIST_NAME, Resources.LoadAll(ACTION_ICONLIST_NAME)); m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_STATE] = (STATE_ICONLIST_NAME, Resources.LoadAll(STATE_ICONLIST_NAME)); - foreach(var icon in m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_STATE].Item2) - { - Debug.Log($"Init: icon: {icon.name}"); - } } public void SetCover(AUIImagePictureBase pImgPic, string nameImage, EC_GAMEUI_ICONS iCONS_TYPE) { diff --git a/Assets/Scripts/EC_Utility.cs b/Assets/Scripts/EC_Utility.cs index 7f9221c0bf..9307600c75 100644 --- a/Assets/Scripts/EC_Utility.cs +++ b/Assets/Scripts/EC_Utility.cs @@ -171,8 +171,8 @@ public static class EC_Utility { suffix = data.action_weapon_suffix[weaponType].Suffix ?? string.Empty; } - var midBodyFixed = FixGBKString(midBody); - return $"{prefix}{midBodyFixed}{suffix}"; + //var midBodyFixed = FixGBKString(midBody); + return $"{prefix}{midBody}{suffix}"; } public static byte glb_BuildBLSMask() { diff --git a/Assets/Scripts/PlayerVisual.cs b/Assets/Scripts/PlayerVisual.cs index 7325e9b47f..5e1a1ad249 100644 --- a/Assets/Scripts/PlayerVisual.cs +++ b/Assets/Scripts/PlayerVisual.cs @@ -203,10 +203,11 @@ namespace BrewMonster _currentAnimationName = fullName; return; } + string fullName2 = fullName; //if contain 空拳 change it to 通用 apply to full name and removeShapeName - if (fullName.Contains("空拳")) + if (fullName2.Contains("空拳")) { - fullName = fullName.Replace("空拳", "通用"); + fullName2 = fullName2.Replace("空拳", "通用"); removeShapeName = removeShapeName.Replace("空拳", "通用"); } bool isState3 = namedAnimancer.States.TryGet(removeShapeName, out var existingState3) ? true : false; @@ -216,11 +217,11 @@ namespace BrewMonster _currentAnimationName = removeShapeName; return; } - bool isState4 = namedAnimancer.States.TryGet(fullName, out var existingState4) ? true : false; + bool isState4 = namedAnimancer.States.TryGet(fullName2, out var existingState4) ? true : false; if (isState4) { - _currentState = namedAnimancer.TryPlay(fullName, duration / 1000, fadeMode); - _currentAnimationName = fullName; + _currentState = namedAnimancer.TryPlay(fullName2, duration / 1000, fadeMode); + _currentAnimationName = fullName2; return; } int index = removeShapeName.IndexOf("空中"); @@ -239,7 +240,7 @@ namespace BrewMonster _currentAnimationName = removeFlyName; return; } - BMLogger.LogError($"Null name animation: {removeFlyName}"); + BMLogger.LogError($"Null name animation: {fullName}"); } ///