animation host done

This commit is contained in:
VDH
2025-09-19 17:39:39 +07:00
parent 53013d7887
commit 0dd73da3c4
12 changed files with 195 additions and 52 deletions
+13 -12
View File
@@ -13,7 +13,6 @@ public class EC_Player : MonoBehaviour
protected void Awake()
{
m_PlayerActions = _default_actions;
BrewMonster.Logger.Log("m_PlayerActions " + m_PlayerActions.Length);
}
public static void InitStaticRes()
@@ -35,7 +34,7 @@ public class EC_Player : MonoBehaviour
PLAYER_ACTION_INFO_CONFIG data;
int count = dataman.get_data_num(ID_SPACE.ID_SPACE_CONFIG);
DATA_TYPE dt = default;
uint id = 0;
@@ -65,13 +64,11 @@ public class EC_Player : MonoBehaviour
_default_actions[i].type = (PLAYER_ACTION_TYPE)i;
string szName = actionNames.GetANSIString(i);
BrewMonster.Logger.Log("HoangDev: szName " + szName);
if (!string.IsNullOrEmpty(szName))
{
if (actionMap.TryGetValue(szName, out var it))
{
_default_actions[i].data = it;
}
}
@@ -91,17 +88,16 @@ public class EC_Player : MonoBehaviour
if (actionConfigID > 0)
{
DATA_TYPE dt = DATA_TYPE.DT_INVALID;
var p = ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)actionConfigID, ID_SPACE. ID_SPACE_CONFIG, ref dt);
var p = ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)actionConfigID, ID_SPACE.ID_SPACE_CONFIG, ref dt);
if (dt == DATA_TYPE.DT_PLAYER_ACTION_INFO_CONFIG)
{
PLAYER_ACTION actionConfig;
actionConfig.type = (PLAYER_ACTION_TYPE)iAction;
actionConfig.data = (PLAYER_ACTION_INFO_CONFIG) p;
actionConfig.data = (PLAYER_ACTION_INFO_CONFIG)p;
return PlayActionWithConfig(iAction, actionConfig, bRestart, iTransTime, bQueue);
}
else
{
BrewMonster.Logger.LogError($"CECPlayer::PlayActionWithConfig, invalid action config ID({actionConfigID})");
}
}
return PlayActionWithConfig(iAction, m_PlayerActions[iAction], bRestart, iTransTime, bQueue);
@@ -111,9 +107,8 @@ public class EC_Player : MonoBehaviour
{
PLAYER_ACTION action = actionConfig;
var szAct = EC_Utility.BuildActionName(action, 10);
BrewMonster.Logger.Log("HoangDev : szActszAct " + szAct);
var szAct = EC_Utility.BuildActionName(action, 0);
EventBus.Publish(new PlayActionEvent(szAct));
return true;
}
public static void Dispose()
@@ -121,8 +116,6 @@ public class EC_Player : MonoBehaviour
_default_actions = null;
_turning_actions = null;
}
public struct PLAYER_ACTION
{
public PLAYER_ACTION_TYPE type;
@@ -265,3 +258,11 @@ public class EC_Player : MonoBehaviour
}
}
public struct PlayActionEvent
{
public string AnimationName;
public PlayActionEvent(string animationName)
{
this.AnimationName = animationName;
}
}