animation host done
This commit is contained in:
@@ -139,7 +139,7 @@ public class CECHostPlayer : EC_Player
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
Vector3 finalMove = (move * playerSpeed) + (playerVelocity.y * Vector3.up);
|
||||
@@ -225,9 +225,9 @@ public class CECHostPlayer : EC_Player
|
||||
var data = Msg.dwParam1 as byte[];
|
||||
int hostId = Convert.ToInt32(Msg.dwParam3);
|
||||
PerfectWorld.Scripts.Managers.EC_Inventory.LogInventoryPacket("OWN_ITEM_INFO", data, hostId);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
public void OnMsgHstIvtrInfo(ECMSG Msg)
|
||||
@@ -260,7 +260,7 @@ public class CECHostPlayer : EC_Player
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
public void OnMsgHstCorrectPos(in ECMSG Msg)
|
||||
@@ -309,13 +309,18 @@ public class CECHostPlayer : EC_Player
|
||||
joystick = FindAnyObjectByType<Joystick>();
|
||||
EventBus.Subscribe<JoystickRealeaseEvent>(JoystickRelease);
|
||||
EventBus.Subscribe<JoystickPressEvent>(JoystickStartDrag);
|
||||
EventBus.Publish(new InitHostPlayerEventDone()) ;
|
||||
}
|
||||
|
||||
private void JoystickStartDrag(JoystickPressEvent joystickPressEvent)
|
||||
{
|
||||
_playerStateMachine.ChangeState(_moveState);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
EventBus.Unsubscribe<JoystickRealeaseEvent>(JoystickRelease);
|
||||
EventBus.Unsubscribe<JoystickPressEvent>(JoystickStartDrag);
|
||||
}
|
||||
public void InitCharacter(info_player_1 role)
|
||||
{
|
||||
string roleName = "(Error decoding name)";
|
||||
@@ -338,3 +343,7 @@ public enum StateAnim
|
||||
Run = 3,
|
||||
Jump = 4
|
||||
}
|
||||
public struct InitHostPlayerEventDone
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -126,6 +126,8 @@ public class CECStringTab
|
||||
var payload = allLines[j].Trim();
|
||||
if (payload.Length == 0) continue;
|
||||
if (payload.StartsWith("#")) continue;
|
||||
if (payload.StartsWith("//")) continue;
|
||||
|
||||
|
||||
if (bIndexMode)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using static EC_Player;
|
||||
|
||||
public class PlayerIdleState : PlayerState
|
||||
{
|
||||
@@ -8,7 +9,7 @@ public class PlayerIdleState : PlayerState
|
||||
|
||||
public override void Enter()
|
||||
{
|
||||
|
||||
_characterCtrl.PlayAction((int)PLAYER_ACTION_TYPE.ACT_STAND, true, 1, false);
|
||||
}
|
||||
|
||||
public override void Exit()
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Animancer;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerVisual : MonoBehaviour
|
||||
{
|
||||
[SerializeField] NamedAnimancerComponent animancer;
|
||||
private void Awake()
|
||||
{
|
||||
EventBus.Subscribe<InitHostPlayerEventDone>(InitHostPlayerEventDoneHandler);
|
||||
EventBus.Subscribe<PlayActionEvent>(PlayActionEventHandler);
|
||||
}
|
||||
|
||||
private void PlayActionEventHandler(PlayActionEvent @event)
|
||||
{
|
||||
BrewMonster.Logger.Log("PlayActionEventHandler : "+@event.AnimationName);
|
||||
animancer.TryPlay(@event.AnimationName);
|
||||
}
|
||||
|
||||
private void InitHostPlayerEventDoneHandler(InitHostPlayerEventDone done)
|
||||
{
|
||||
animancer = GetComponentInChildren<NamedAnimancerComponent>();
|
||||
if(animancer == null)
|
||||
{
|
||||
BrewMonster.Logger.Log("animancer == null");
|
||||
}
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
EventBus.Unsubscribe<InitHostPlayerEventDone>(InitHostPlayerEventDoneHandler);
|
||||
EventBus.Unsubscribe<PlayActionEvent>(PlayActionEventHandler);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a78da6c5cf986974bae4f219bec9686b
|
||||
Reference in New Issue
Block a user