Add animation for skill

This commit is contained in:
Chomper9981
2026-03-25 11:19:48 +07:00
parent 7e53b4ff7e
commit 0dfff3a4ae
5 changed files with 30 additions and 29 deletions
@@ -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
+19 -16
View File
@@ -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
{
@@ -345,10 +345,6 @@ namespace BrewMonster.UI
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_SKILL] = (SKILL_ICONLIST_NAME, Resources.LoadAll<Sprite>(SKILL_ICONLIST_NAME));
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_ACTION] = (ACTION_ICONLIST_NAME, Resources.LoadAll<Sprite>(ACTION_ICONLIST_NAME));
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_STATE] = (STATE_ICONLIST_NAME, Resources.LoadAll<Sprite>(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)
{
+2 -2
View File
@@ -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()
{
+7 -6
View File
@@ -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}");
}
/// <summary>