animation attack done
This commit is contained in:
@@ -8,6 +8,24 @@ public class CECAttacksMan : MonoSingleton<CECAttacksMan>
|
||||
{
|
||||
private readonly List<CECAttackEvent> m_AttackList = new List<CECAttackEvent>();
|
||||
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
for (int i = 0; i < m_AttackList.Count; i++)
|
||||
{
|
||||
var attack = m_AttackList[i];
|
||||
if (attack.m_bFinished)
|
||||
{
|
||||
m_AttackList.RemoveAt(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CECAttackerEvents FindAttackByAttacker(int idHost)
|
||||
{
|
||||
CECAttackerEvents result = new CECAttackerEvents();
|
||||
|
||||
@@ -18,11 +18,14 @@ public abstract class CECPlayer : CECObject
|
||||
protected float rotationSpeed = 5;
|
||||
internal int m_iMoveMode; // Player's move mode
|
||||
internal int m_idSelTarget;
|
||||
protected int m_iShape; // Ñ¡ÖÐÄ¿±êµÄID
|
||||
uint m_dwStates; // Player's basic states
|
||||
protected int m_iShape; // Ñ¡ÖÐÄ¿±êµÄID
|
||||
protected uint m_dwStates; // Player's basic states
|
||||
protected uint m_uAttackType;
|
||||
protected int[] m_aEquips;
|
||||
protected ROLEEXTPROP m_ExtProps; // Extend properties
|
||||
protected float m_fTouchRad = 0.3f; // Touch radius
|
||||
protected int m_iFashionWeaponType;
|
||||
protected float m_fTouchRad = 0.3f; // Touch radius
|
||||
protected bool m_bWeaponAttached;
|
||||
protected int m_iBattleCamp = Player_camp_in_battle.GP_BATTLE_CAMP_NONE; // Battle this player belongs to
|
||||
byte m_factionPVPMask; // pvp mask
|
||||
protected uint m_dwResFlags; // pvp mask
|
||||
@@ -33,7 +36,12 @@ public abstract class CECPlayer : CECObject
|
||||
public A3DAABB m_aabb = new A3DAABB(); // Player's aabb£¬ÓÃÓÚÏÔʾµÄaabb£¬ÊÜËõ·ÅÓ°Ïì
|
||||
public int m_iProfession; // Profession
|
||||
public float m_fScaleBySkill;
|
||||
public int m_iGender; // Gender
|
||||
public int m_iGender; // Gender
|
||||
protected bool m_bFashionMode;
|
||||
|
||||
protected int NUM_WEAPON_TYPE = 15;
|
||||
|
||||
|
||||
public MOVECONST m_MoveConst; // Const used when moving control
|
||||
|
||||
public MOVECONST[] aMoveConsts = new MOVECONST[PROFESSION.NUM_PROFESSION * GENDER.NUM_GENDER]
|
||||
@@ -111,6 +119,10 @@ public abstract class CECPlayer : CECObject
|
||||
m_iShape = 0;
|
||||
m_aEquips = new int[(int)IndexOfIteminEquipmentInventory.SIZE_ALL_EQUIPIVTR];
|
||||
}
|
||||
public void SetUpPlayer()
|
||||
{
|
||||
m_dwResFlags = 0;
|
||||
}
|
||||
public void SetPlayerInfor(INFO playinfo)
|
||||
{
|
||||
m_PlayerInfo = playinfo;
|
||||
@@ -382,8 +394,8 @@ public abstract class CECPlayer : CECObject
|
||||
public void PlayAttackEffect(int idTarget, int idSkill, int skillLevel, int nDamage,
|
||||
uint dwModifier, int nAttackSpeed, ref int piAttackTime/* NULL */, int nSection = 0)
|
||||
{
|
||||
if (!IsAllResReady())
|
||||
return;
|
||||
/* if (!IsAllResReady())
|
||||
return;*/
|
||||
|
||||
if (idSkill == 0)
|
||||
{
|
||||
@@ -419,7 +431,7 @@ public abstract class CECPlayer : CECObject
|
||||
{
|
||||
if (!IsDead() && (dwModifier & (uint)MOD.MOD_RETORT) == 0
|
||||
&& (dwModifier & (uint)MOD.MOD_ATTACK_AURA) == 0
|
||||
&& PlayAttackAction(nAttackSpeed,out piAttackTime,ref pAttack.m_bSignaled)
|
||||
&& PlayAttackAction(nAttackSpeed, out piAttackTime, ref pAttack.m_bSignaled)
|
||||
&& (dwModifier & (uint)MOD.MOD_BEAT_BACK) == 0)
|
||||
{
|
||||
}
|
||||
@@ -431,63 +443,63 @@ public abstract class CECPlayer : CECObject
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if (skillLevel == 0)
|
||||
{
|
||||
if (m_pCurSkill)
|
||||
skillLevel = m_pCurSkill->GetSkillLevel();
|
||||
else
|
||||
skillLevel = 1;
|
||||
}
|
||||
/* if (skillLevel == 0)
|
||||
{
|
||||
if (m_pCurSkill)
|
||||
skillLevel = m_pCurSkill->GetSkillLevel();
|
||||
else
|
||||
skillLevel = 1;
|
||||
}
|
||||
|
||||
CECAttackEvent* pAttack = NULL;
|
||||
CECAttackEvent* pAttack = NULL;
|
||||
|
||||
// first try to find if there is already a skill attack event in attackman
|
||||
CECAttackerEvents attackerEvents = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->FindAttackByAttacker(GetPlayerInfo().cid);
|
||||
if (attackerEvents)
|
||||
{
|
||||
if (CECAttackEvent * pAttack = attackerEvents.Find(idSkill, nSection))
|
||||
{
|
||||
// Ãæ¹¥»÷µÄ·ÇµÚÒ»´ÎÉ˺¦ÏûÏ¢
|
||||
pAttack->AddTarget(idTarget, dwModifier, nDamage);
|
||||
goto EXIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
attackerEvents.Signal();
|
||||
}
|
||||
}
|
||||
if (GNET::ElementSkill::IsGoblinSkill(idSkill) &&
|
||||
GNET::ElementSkill::GetType(idSkill) == 2)
|
||||
{
|
||||
pAttack = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->AddSkillAttack(
|
||||
GetPlayerInfo().cid, GetPlayerInfo().cid, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// begin a skill attack
|
||||
pAttack = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->AddSkillAttack(
|
||||
GetPlayerInfo().cid, m_idCurSkillTarget, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
|
||||
}
|
||||
// first try to find if there is already a skill attack event in attackman
|
||||
CECAttackerEvents attackerEvents = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->FindAttackByAttacker(GetPlayerInfo().cid);
|
||||
if (attackerEvents)
|
||||
{
|
||||
if (CECAttackEvent * pAttack = attackerEvents.Find(idSkill, nSection))
|
||||
{
|
||||
// Ãæ¹¥»÷µÄ·ÇµÚÒ»´ÎÉ˺¦ÏûÏ¢
|
||||
pAttack->AddTarget(idTarget, dwModifier, nDamage);
|
||||
goto EXIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
attackerEvents.Signal();
|
||||
}
|
||||
}
|
||||
if (GNET::ElementSkill::IsGoblinSkill(idSkill) &&
|
||||
GNET::ElementSkill::GetType(idSkill) == 2)
|
||||
{
|
||||
pAttack = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->AddSkillAttack(
|
||||
GetPlayerInfo().cid, GetPlayerInfo().cid, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// begin a skill attack
|
||||
pAttack = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->AddSkillAttack(
|
||||
GetPlayerInfo().cid, m_idCurSkillTarget, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
|
||||
}
|
||||
|
||||
if (pAttack)
|
||||
{
|
||||
pAttack->SetSkillSection(nSection);
|
||||
if (!IsDead() && (dwModifier & CECAttackEvent::MOD_RETORT) == 0
|
||||
&& (dwModifier & CECAttackEvent::MOD_ATTACK_AURA) == 0
|
||||
&& PlaySkillAttackAction(idSkill, nAttackSpeed, NULL, nSection, &pAttack->m_bSignaled)
|
||||
&& (dwModifier & CECAttackEvent::MOD_BEAT_BACK) == 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
pAttack->m_bSignaled = true;
|
||||
}
|
||||
}
|
||||
if (pAttack)
|
||||
{
|
||||
pAttack->SetSkillSection(nSection);
|
||||
if (!IsDead() && (dwModifier & CECAttackEvent::MOD_RETORT) == 0
|
||||
&& (dwModifier & CECAttackEvent::MOD_ATTACK_AURA) == 0
|
||||
&& PlaySkillAttackAction(idSkill, nAttackSpeed, NULL, nSection, &pAttack->m_bSignaled)
|
||||
&& (dwModifier & CECAttackEvent::MOD_BEAT_BACK) == 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
pAttack->m_bSignaled = true;
|
||||
}
|
||||
}
|
||||
|
||||
EXIT:
|
||||
// For skill attacking, time is always set to 0
|
||||
if (piAttackTime)
|
||||
*piAttackTime = 0;*/
|
||||
EXIT:
|
||||
// For skill attacking, time is always set to 0
|
||||
if (piAttackTime)
|
||||
*piAttackTime = 0;*/
|
||||
}
|
||||
}
|
||||
public bool PlayAttackAction(int nAttackSpeed, out int attackTime, ref bool pActFlag)
|
||||
@@ -500,9 +512,9 @@ public abstract class CECPlayer : CECObject
|
||||
int nRand = UnityEngine.Random.Range(0, 4);
|
||||
string szAct = string.Empty;
|
||||
|
||||
int weapon_type = GetShowingWeaponType();
|
||||
//int weapon_type = GetShowingWeaponType();
|
||||
|
||||
int nTime1 = 0 , nTime2 = 0;
|
||||
int nTime1 = 0, nTime2 = 0;
|
||||
int iAction = (int)PLAYER_ACTION_TYPE.ACT_ATTACK_1 + nRand;
|
||||
PLAYER_ACTION action = m_PlayerActions[iAction];
|
||||
|
||||
@@ -511,8 +523,8 @@ public abstract class CECPlayer : CECObject
|
||||
|
||||
ShowWeaponByConfig(action.data);
|
||||
|
||||
/* var pRightHandWeapon = GetRightHandWeapon();
|
||||
bool bHideFX = !CECOptimize.Instance.GFX.CanShowAttack(GetCharacterID(), GetClassID());*/
|
||||
/* var pRightHandWeapon = GetRightHandWeapon();
|
||||
bool bHideFX = !CECOptimize.Instance.GFX.CanShowAttack(GetCharacterID(), GetClassID());*/
|
||||
|
||||
// ==============================
|
||||
// Ground Attack
|
||||
@@ -521,26 +533,24 @@ public abstract class CECPlayer : CECObject
|
||||
{
|
||||
// “起” 动作(挥起)
|
||||
szAct = EC_Utility.BuildActionName(action, 0, "Æð");
|
||||
BMLogger.LogError("HoangDev: PlayAttackAction: " + szAct);
|
||||
EventBus.PublishChannel(m_PlayerInfo.cid, new PlayActionEvent(szAct));
|
||||
szAct = EC_Utility.BuildActionName(action, 0, "Âä");
|
||||
BMLogger.LogError("HoangDev: PlayAttackAction: " + szAct);
|
||||
EventBus.PublishChannel(m_PlayerInfo.cid, new QueueActionEvent(szAct));
|
||||
//PlayNonSkillActionWithName(iAction, szAct, true, 200, true, ref pActFlag, COMACT_FLAG_MODE_ONCE_MULTIIGNOREGFX);
|
||||
/*
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
pRightHandWeapon.PlayActionByName(_GenWeaponActionName(szAct, m_iGender), 1.0f, true, 200, true, iAction, bHideFX);
|
||||
/*
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
pRightHandWeapon.PlayActionByName(_GenWeaponActionName(szAct, m_iGender), 1.0f, true, 200, true, iAction, bHideFX);
|
||||
|
||||
nTime1 = _pPlayerModel.GetComActTimeSpanByName(szAct);
|
||||
nTime1 = _pPlayerModel.GetComActTimeSpanByName(szAct);
|
||||
|
||||
// “收” 动作(挥下)
|
||||
szAct = $"{action.data.action_prefix}_{action.data.action_weapon_suffix[weapon_type].suffix}Âä";
|
||||
QueueNonSkillActionWithName(iAction, szAct, 0, false, bHideFX);
|
||||
// “收” 动作(挥下)
|
||||
szAct = $"{action.data.action_prefix}_{action.data.action_weapon_suffix[weapon_type].suffix}Âä";
|
||||
QueueNonSkillActionWithName(iAction, szAct, 0, false, bHideFX);
|
||||
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
pRightHandWeapon.QueueAction(_GenWeaponActionName(szAct, m_iGender), 0, iAction, false, false, bHideFX);
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
pRightHandWeapon.QueueAction(_GenWeaponActionName(szAct, m_iGender), 0, iAction, false, false, bHideFX);
|
||||
|
||||
nTime2 = _pPlayerModel.GetComActTimeSpanByName(szAct);*/
|
||||
nTime2 = _pPlayerModel.GetComActTimeSpanByName(szAct);*/
|
||||
}
|
||||
// ==============================
|
||||
// Air Attack
|
||||
@@ -582,9 +592,8 @@ public abstract class CECPlayer : CECObject
|
||||
// ==============================
|
||||
// Kết thúc bằng FightStand
|
||||
// ==============================
|
||||
PLAYER_ACTION stand_action = m_PlayerActions[(int)PLAYER_ACTION_TYPE. ACT_FIGHTSTAND];
|
||||
PLAYER_ACTION stand_action = m_PlayerActions[(int)PLAYER_ACTION_TYPE.ACT_FIGHTSTAND];
|
||||
szAct = EC_Utility.BuildActionName(stand_action, 0);
|
||||
BMLogger.LogError("HoangDev: PlayAttackAction: " + szAct);
|
||||
EventBus.PublishChannel(m_PlayerInfo.cid, new QueueActionEvent(szAct));
|
||||
|
||||
/* QueueNonSkillActionWithName(ACT_FIGHTSTAND, szAct, 300, false, bHideFX, true);
|
||||
@@ -595,19 +604,19 @@ public abstract class CECPlayer : CECObject
|
||||
// ==============================
|
||||
// Điều chỉnh tốc độ phát animation theo tốc độ tấn công
|
||||
// ==============================
|
||||
/* if (nAttackSpeed > 0)
|
||||
{
|
||||
float vScale = (nTime1 + nTime2) / (float)nAttackSpeed;
|
||||
if (vScale > 0f)
|
||||
{
|
||||
m_pPlayerModel.SetPlaySpeed(vScale);
|
||||
/* if (nAttackSpeed > 0)
|
||||
{
|
||||
float vScale = (nTime1 + nTime2) / (float)nAttackSpeed;
|
||||
if (vScale > 0f)
|
||||
{
|
||||
m_pPlayerModel.SetPlaySpeed(vScale);
|
||||
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
pRightHandWeapon.SetPlaySpeed(vScale);
|
||||
}
|
||||
}
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
pRightHandWeapon.SetPlaySpeed(vScale);
|
||||
}
|
||||
}
|
||||
|
||||
attackTime = nTime1 + nTime2;*/
|
||||
attackTime = nTime1 + nTime2;*/
|
||||
|
||||
// ==============================
|
||||
// Cập nhật vị trí weapon hanger (vũ khí)
|
||||
@@ -619,7 +628,7 @@ public abstract class CECPlayer : CECObject
|
||||
public bool m_bShowWeapon;
|
||||
public void ShowWeaponByConfig(PLAYER_ACTION_INFO_CONFIG p)
|
||||
{
|
||||
m_bShowWeapon = p.hide_weapon!= 0 ? false : true;
|
||||
m_bShowWeapon = p.hide_weapon != 0 ? false : true;
|
||||
//ShowWeapon(m_bShowWeapon);
|
||||
}
|
||||
public int GetShowingWeaponType()
|
||||
@@ -671,6 +680,7 @@ public abstract class CECPlayer : CECObject
|
||||
if (tid != 0)
|
||||
{
|
||||
pFashionConfig = (FASHION_WEAPON_CONFIG)pDataMan.get_data_ptr(tid, ID_SPACE.ID_SPACE_CONFIG, ref DataType);
|
||||
BMLogger.LogError($"HoangDev : get_data_ptr {pFashionConfig.GetType()}");
|
||||
}
|
||||
}
|
||||
return pFashionConfig.Value;
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace CSNetwork
|
||||
}
|
||||
var pCmdHeader = BitConverter.ToUInt16(byteArrHeader);
|
||||
//sss
|
||||
_logger.Info($"### GameDataSend: CMDID {pCmdHeader}");
|
||||
BMLogger.LogError($"### GameDataSend: CMDID {pCmdHeader}");
|
||||
int iHostID = _selectedRole.roleid;
|
||||
switch (pCmdHeader)
|
||||
{
|
||||
@@ -339,7 +339,6 @@ namespace CSNetwork
|
||||
case CommandID.PLAYER_INFO_00:
|
||||
case CommandID.SELF_INFO_1:
|
||||
// OnMsgPlayerInfo(-1, pDataBuf, pCmdHeader);
|
||||
_logger.Info($"HoangDev : EC_MsgDef.MSG_PM_PLAYERINFO");
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERINFO, (int)MANAGER_INDEX.MAN_PLAYER, -1, pDataBuf, pCmdHeader, iHostID, _selectedRole);
|
||||
break;
|
||||
case CommandID.OBJECT_MOVE:
|
||||
@@ -352,7 +351,6 @@ namespace CSNetwork
|
||||
}
|
||||
else if (ISNPCID(idObjMove))
|
||||
{
|
||||
_logger.Info("HoangDev : NPC OBJECT_MOVE");
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCMOVE, (int)MANAGER_INDEX.MAN_NPC, 0, pDataBuf, pCmdHeader);
|
||||
}
|
||||
break;
|
||||
@@ -365,7 +363,6 @@ namespace CSNetwork
|
||||
}
|
||||
else if (ISNPCID(id1))
|
||||
{
|
||||
_logger.Info("HoangDev : NPC OBJECT_MOVE");
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCSTOPMOVE, (int)MANAGER_INDEX.MAN_NPC, 0, pDataBuf, pCmdHeader);
|
||||
}
|
||||
break;
|
||||
@@ -374,7 +371,6 @@ namespace CSNetwork
|
||||
case CommandID.OWN_IVTR_DETAIL_DATA:
|
||||
case CommandID.GET_OWN_MONEY:
|
||||
case CommandID.CHANGE_IVTR_SIZE:
|
||||
_logger.Info($"HUNG INVENTORY2");
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_IVTRINFO, (int)MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader, iHostID);
|
||||
break;
|
||||
case CommandID.EXG_IVTR_ITEM:
|
||||
@@ -385,7 +381,6 @@ namespace CSNetwork
|
||||
case CommandID.MOVE_EQUIP_ITEM:
|
||||
case CommandID.UNFREEZE_IVTR_SLOT:
|
||||
case CommandID.PLAYER_EQUIP_TRASHBOX_ITEM:
|
||||
_logger.Info($"HUNG EQUIP ITEM: " + pCmdHeader);
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_ITEMOPERATION, (int)MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
|
||||
break;
|
||||
case CommandID.MATTER_INFO_LIST:
|
||||
@@ -398,7 +393,6 @@ namespace CSNetwork
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_PICKUPITEM, (int)MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
|
||||
break;
|
||||
case CommandID.HOST_CORRECT_POS:
|
||||
_logger.Info($"HoangDev HOST_CORRECT_POSHOST_CORRECT_POSHOST_CORRECT_POS");
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_CORRECTPOS, (int)MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader, iHostID);
|
||||
break;
|
||||
case CommandID.OWN_ITEM_INFO:
|
||||
@@ -409,7 +403,6 @@ namespace CSNetwork
|
||||
case CommandID.NPC_INFO_00:
|
||||
case CommandID.NPC_ENTER_WORLD:
|
||||
case CommandID.NPC_VISIBLE_TID_NOTIFY:
|
||||
_logger.Info($"HoangDev :NPC_VISIBLE_TID_NOTIFY");
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCINFO, (int)MANAGER_INDEX.MAN_NPC, 0, pDataBuf, pCmdHeader, dwDataSize);
|
||||
break;
|
||||
case CommandID.TASK_DATA:
|
||||
@@ -429,11 +422,9 @@ namespace CSNetwork
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCATKRESULT, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
|
||||
break;
|
||||
case CommandID.HOST_ATTACKRESULT:
|
||||
BMLogger.LogError("HoangDev : HOST_ATTACKRESULT");
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_ATKRESULT, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
|
||||
break;
|
||||
case CommandID.HOST_ATTACKED:
|
||||
BMLogger.LogError("HoangDev : HOST_ATTACKED");
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_ATTACKED, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
|
||||
break;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace BrewMonster.UI
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.Tab))
|
||||
{
|
||||
_usernameInputField.text = "test002";
|
||||
_usernameInputField.text = "test005";
|
||||
_passwordInputField.text = "123456";
|
||||
OnLoginButtonClicked();
|
||||
}
|
||||
|
||||
@@ -812,6 +812,11 @@ MonoBehaviour:
|
||||
- {fileID: 7400000, guid: 29895f3687b86a24ba1bff2318b1d817, type: 2}
|
||||
- {fileID: 7400000, guid: 9b5c3773d9888954c95132e25788ae54, type: 2}
|
||||
- {fileID: 7400000, guid: 5f21aa4feb9cf1e49b63d5e7b7d9ad58, type: 2}
|
||||
- {fileID: 7400000, guid: 4c93f18fe5082524d8ccda024f7988ad, type: 2}
|
||||
- {fileID: 7400000, guid: bc909de03ae7dcc4d824253bf652de1d, type: 2}
|
||||
- {fileID: 7400000, guid: 211cf985d64485e4ca42f7d8d6509e87, type: 2}
|
||||
- {fileID: 7400000, guid: caa9485da71a78b4da087ae69bf7120d, type: 2}
|
||||
- {fileID: 7400000, guid: 233ca05b3510f614e8b2ea31731dc298, type: 2}
|
||||
--- !u!21 &19752687
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
|
||||
@@ -350,8 +350,9 @@ public class CECHostPlayer : CECPlayer
|
||||
}
|
||||
public void OnMsgHstAttackResult(ECMSG Msg)
|
||||
{
|
||||
|
||||
cmd_host_attack_result pCmd = (cmd_host_attack_result)Msg.dwParam1;
|
||||
BMLogger.LogError($"dwParam1 type = {Msg.dwParam1?.GetType()}");
|
||||
byte[] data = Msg.dwParam1 as byte[];
|
||||
cmd_host_attack_result pCmd = EC_Utility.ByteArrayToStructure<cmd_host_attack_result>(data);
|
||||
|
||||
int iAttackTime = 0;
|
||||
PlayAttackEffect(pCmd.idTarget, 0, 0, pCmd.iDamage, (uint)pCmd.attack_flag, pCmd.attack_speed * 50, ref iAttackTime);
|
||||
@@ -365,117 +366,6 @@ public class CECHostPlayer : CECPlayer
|
||||
}
|
||||
}
|
||||
}
|
||||
public void PlayAttackEffect(int idTarget, int idSkill, int skillLevel, int nDamage,
|
||||
uint dwModifier, int nAttackSpeed, ref int piAttackTime/* NULL */, int nSection = 0)
|
||||
{
|
||||
/* if (!IsAllResReady())
|
||||
return;
|
||||
|
||||
if (idSkill == 0)
|
||||
{
|
||||
int idWeapon = IsShapeChanged() ? 0 : GetWeaponID();
|
||||
|
||||
int nTimeFly = 10;
|
||||
if (idWeapon != 0)
|
||||
{
|
||||
// ¿´¿´ÊDz»ÊÇÔ¶³ÌÎäÆ÷
|
||||
DATA_TYPE dt = default;
|
||||
WEAPON_ESSENCE? pWeapon = (WEAPON_ESSENCE)ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)idWeapon, ID_SPACE.ID_SPACE_ESSENCE, ref dt);
|
||||
|
||||
if (dt == DATA_TYPE.DT_WEAPON_ESSENCE && pWeapon != null && pWeapon.Value.require_projectile != 0)
|
||||
{
|
||||
nTimeFly = 700;
|
||||
|
||||
if (m_aEquips[(int)IndexOfIteminEquipmentInventory.EQUIPIVTR_PROJECTILE] != 0)
|
||||
idWeapon = m_aEquips[(int)IndexOfIteminEquipmentInventory.EQUIPIVTR_PROJECTILE];
|
||||
}
|
||||
}
|
||||
|
||||
if (g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->FindAttackByAttacker(GetPlayerInfo().cid))
|
||||
{
|
||||
// signal early attack event
|
||||
ClearComActFlagAllRankNodes(true);
|
||||
}
|
||||
|
||||
// melee attack
|
||||
CECAttackEvent* pAttack = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->AddMeleeAttack(
|
||||
GetPlayerInfo().cid, idTarget, idWeapon, dwModifier, nDamage, nTimeFly);
|
||||
|
||||
if (pAttack)
|
||||
{
|
||||
if (!IsDead() && (dwModifier & CECAttackEvent::MOD_RETORT) == 0
|
||||
&& (dwModifier & CECAttackEvent::MOD_ATTACK_AURA) == 0
|
||||
&& PlayAttackAction(nAttackSpeed, piAttackTime, &pAttack->m_bSignaled)
|
||||
&& (dwModifier & CECAttackEvent::MOD_BEAT_BACK) == 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
pAttack->m_bSignaled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (skillLevel == 0)
|
||||
{
|
||||
if (m_pCurSkill)
|
||||
skillLevel = m_pCurSkill->GetSkillLevel();
|
||||
else
|
||||
skillLevel = 1;
|
||||
}
|
||||
|
||||
CECAttackEvent* pAttack = NULL;
|
||||
|
||||
// first try to find if there is already a skill attack event in attackman
|
||||
CECAttackerEvents attackerEvents = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->FindAttackByAttacker(GetPlayerInfo().cid);
|
||||
if (attackerEvents)
|
||||
{
|
||||
if (CECAttackEvent * pAttack = attackerEvents.Find(idSkill, nSection))
|
||||
{
|
||||
// Ãæ¹¥»÷µÄ·ÇµÚÒ»´ÎÉ˺¦ÏûÏ¢
|
||||
pAttack->AddTarget(idTarget, dwModifier, nDamage);
|
||||
goto EXIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
attackerEvents.Signal();
|
||||
}
|
||||
}
|
||||
if (GNET::ElementSkill::IsGoblinSkill(idSkill) &&
|
||||
GNET::ElementSkill::GetType(idSkill) == 2)
|
||||
{
|
||||
pAttack = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->AddSkillAttack(
|
||||
GetPlayerInfo().cid, GetPlayerInfo().cid, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// begin a skill attack
|
||||
pAttack = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->AddSkillAttack(
|
||||
GetPlayerInfo().cid, m_idCurSkillTarget, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
|
||||
}
|
||||
|
||||
if (pAttack)
|
||||
{
|
||||
pAttack->SetSkillSection(nSection);
|
||||
if (!IsDead() && (dwModifier & CECAttackEvent::MOD_RETORT) == 0
|
||||
&& (dwModifier & CECAttackEvent::MOD_ATTACK_AURA) == 0
|
||||
&& PlaySkillAttackAction(idSkill, nAttackSpeed, NULL, nSection, &pAttack->m_bSignaled)
|
||||
&& (dwModifier & CECAttackEvent::MOD_BEAT_BACK) == 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
pAttack->m_bSignaled = true;
|
||||
}
|
||||
}
|
||||
|
||||
EXIT:
|
||||
// For skill attacking, time is always set to 0
|
||||
if (piAttackTime)
|
||||
*piAttackTime = 0;
|
||||
}*/
|
||||
}
|
||||
private void OnMsgHstHurtResult(ECMSG Msg)
|
||||
{
|
||||
/* BMLogger.LogError("HoangDev : OnMsgHstHurtResult");
|
||||
@@ -754,6 +644,7 @@ public class CECHostPlayer : CECPlayer
|
||||
if (txtName != null) txtName.text = roleName;
|
||||
transform.position = pos;
|
||||
SetModelHostPlayer();
|
||||
m_dwResFlags = (uint)PlayerResourcesReadyFlag.RESFG_ALL;
|
||||
Debug.LogError("Pos Character = " + pos);
|
||||
joystick = FindAnyObjectByType<Joystick>();
|
||||
EventBus.Subscribe<JoystickRealeaseEvent>(JoystickRelease);
|
||||
|
||||
@@ -3,6 +3,7 @@ using CSNetwork.GPDataType;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using static CECPlayer;
|
||||
|
||||
@@ -32,16 +33,21 @@ public static class EC_Utility
|
||||
}
|
||||
}
|
||||
public static float FIX8TOFLOAT(int x) => x / 256.0f;
|
||||
public static T ByteArrayToStructure<T>(byte[] bytes) where T : struct
|
||||
public static T ByteArrayToStructure<T>(byte[] data) where T : struct
|
||||
{
|
||||
GCHandle handle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
|
||||
int size = Marshal.SizeOf(typeof(T));
|
||||
if (data.Length < size)
|
||||
throw new ArgumentException($"Data length {data.Length} < struct size {size}");
|
||||
|
||||
IntPtr ptr = Marshal.AllocHGlobal(size);
|
||||
try
|
||||
{
|
||||
return Marshal.PtrToStructure<T>(handle.AddrOfPinnedObject());
|
||||
Marshal.Copy(data, 0, ptr, size);
|
||||
return Marshal.PtrToStructure<T>(ptr);
|
||||
}
|
||||
finally
|
||||
{
|
||||
handle.Free();
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
}
|
||||
}
|
||||
public static Vector3 glb_DecompressDirH(byte byDir)
|
||||
@@ -72,6 +78,17 @@ public static class EC_Utility
|
||||
{
|
||||
return Mathf.Sqrt(v.x * v.x + v.z * v.z);
|
||||
}
|
||||
public static string FixGBKString(string input)
|
||||
{
|
||||
// Giả sử input hiện đang là "Æð"
|
||||
// B1: lấy bytes theo "Latin1" (mỗi ký tự 1 byte giữ nguyên giá trị gốc)
|
||||
byte[] bytes = Encoding.GetEncoding("ISO-8859-1").GetBytes(input);
|
||||
|
||||
// B2: giải mã lại bằng GBK (Code page 936)
|
||||
string decoded = Encoding.GetEncoding(936).GetString(bytes);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
public static string BuildActionName(PLAYER_ACTION action, int weaponType, string tail = "")
|
||||
{
|
||||
string prefix = action.data.ActionPrefix ?? string.Empty;
|
||||
@@ -83,8 +100,8 @@ public static class EC_Utility
|
||||
{
|
||||
suffix = action.data.action_weapon_suffix[weaponType].Suffix ?? string.Empty;
|
||||
}
|
||||
|
||||
return $"{prefix}_{suffix}tail";
|
||||
var tailFixed = FixGBKString(tail);
|
||||
return $"{prefix}_{suffix}{tailFixed}";
|
||||
}
|
||||
|
||||
// Build pvp mask
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Animancer;
|
||||
using BrewMonster;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -9,12 +10,17 @@ public class PlayerVisual : MonoBehaviour
|
||||
|
||||
[SerializeField] private INFO _playerInfo;
|
||||
|
||||
private AnimancerState _currentState;
|
||||
|
||||
[SerializeField] private AnimancerState _currentState;
|
||||
private readonly Queue<string> _animationQueue = new Queue<string>();
|
||||
|
||||
private void PlayActionEventHandler(PlayActionEvent @event)
|
||||
{
|
||||
_currentState = namedAnimancer.TryPlay(@event.AnimationName);
|
||||
if(_currentState == null)
|
||||
{
|
||||
BMLogger.LogError("HoangDev: PlayActionEventHandler Failed ");
|
||||
}
|
||||
}
|
||||
|
||||
public void InitHostPlayerEventDoneHandler()
|
||||
@@ -38,17 +44,23 @@ public class PlayerVisual : MonoBehaviour
|
||||
|
||||
private void QueueActionEventHandler(QueueActionEvent @event)
|
||||
{
|
||||
EnqueueAnimation(@event.AnimationName);
|
||||
if(!EnqueueAnimation(@event.AnimationName))
|
||||
{
|
||||
BMLogger.LogError("HoangDev : EnqueueAnimation Failed");
|
||||
}
|
||||
}
|
||||
public void EnqueueAnimation(string animName)
|
||||
public bool EnqueueAnimation(string animName)
|
||||
{
|
||||
if (namedAnimancer == null) return false;
|
||||
_animationQueue.Enqueue(animName);
|
||||
if (!namedAnimancer.IsPlaying())
|
||||
PlayNext();
|
||||
else
|
||||
{
|
||||
if (_currentState == null) return false;
|
||||
_currentState.Events.OnEnd = PlayNext;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void PlayNext()
|
||||
|
||||
+217
-9
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user