npc die done
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using BrewMonster;
|
||||
using BrewMonster;
|
||||
using CSNetwork.GPDataType;
|
||||
using System;
|
||||
using System.Collections;
|
||||
@@ -145,6 +145,8 @@ public class CECAttackEvent
|
||||
if (m_timeLived > 3500)
|
||||
{
|
||||
// too long time, this event will be deleted now
|
||||
BMLogger.LogError("HoangDev: m_bSignaled: " + m_bSignaled);
|
||||
|
||||
m_bFinished = true;
|
||||
//DoFire();
|
||||
DoDamage();
|
||||
@@ -168,6 +170,7 @@ public class CECAttackEvent
|
||||
}
|
||||
else if (m_timeToDoDamage != 0)
|
||||
{
|
||||
BMLogger.LogError("HoangDev: m_timeToDoDamage: " + m_timeToDoDamage);
|
||||
if (m_timeToDoDamage <= dwDeltaTime)
|
||||
{
|
||||
m_timeToDoDamage = 0;
|
||||
|
||||
@@ -9,24 +9,23 @@ using System.Runtime.InteropServices;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class CECNPCMan : CECObject, IMsgHandler
|
||||
public class CECNPCMan : IMsgHandler
|
||||
{
|
||||
private Dictionary<int, CECNPC> m_NPCTab = new Dictionary<int, CECNPC>(512);
|
||||
private Dictionary<int, int> m_UkNPCTab = new Dictionary<int, int>(32);
|
||||
|
||||
|
||||
List<CECNPC> m_aDisappearNPCs = new List<CECNPC>(32);
|
||||
Vector3 m_vServerPos;
|
||||
public int HandlerId => (int)MANAGER_INDEX.MAN_NPC;
|
||||
|
||||
public CECNPCMan()
|
||||
{
|
||||
m_vServerPos = Vector3.zero;
|
||||
m_iCID = (int)Class_ID.OCID_MONSTER;
|
||||
}
|
||||
public bool ProcessMessage(ECMSG Msg)
|
||||
{
|
||||
if (Msg.iSubID == 0)
|
||||
{
|
||||
BMLogger.Log("HoangDev : CECNPCManProcessMessage " + Convert.ToInt32(Msg.dwMsg));
|
||||
switch (Msg.dwMsg)
|
||||
{
|
||||
case long value when value == EC_MsgDef.MSG_NM_NPCINFO: OnMsgNPCInfo(Msg); break;
|
||||
@@ -39,7 +38,28 @@ public class CECNPCMan : CECObject, IMsgHandler
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public void Tick()
|
||||
{
|
||||
int SIZE_REMOVETAB = 64;
|
||||
int iRemoveCnt = 0;
|
||||
CECNPC[] aRemove = new CECNPC[64];
|
||||
|
||||
foreach (var pNPC in m_NPCTab.Values)
|
||||
{
|
||||
if (pNPC.ShouldDisappear())
|
||||
{
|
||||
if (iRemoveCnt < SIZE_REMOVETAB)
|
||||
aRemove[iRemoveCnt++] = pNPC;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < iRemoveCnt; i++)
|
||||
NPCLeave(aRemove[i].GetNPCID());
|
||||
}
|
||||
private void OnMsgNPCDisappear(ECMSG Msg)
|
||||
{
|
||||
var pCmd = GPDataTypeHelper.FromBytes<cmd_object_disappear>((byte[])Msg.dwParam1);
|
||||
@@ -98,8 +118,8 @@ public class CECNPCMan : CECObject, IMsgHandler
|
||||
pHost.RemoveObjectFromTabSels(pNPC);
|
||||
}
|
||||
|
||||
/* CECPlayerWrapper* pWrapper = CECAutoPolicy::GetInstance().GetPlayerWrapper();
|
||||
if (pWrapper) pWrapper->OnObjectDisappear(nid);*/
|
||||
/* CECPlayerWrapper* pWrapper = CECAutoPolicy::GetInstance().GetPlayerWrapper();
|
||||
if (pWrapper) pWrapper->OnObjectDisappear(nid);*/
|
||||
}
|
||||
void ReleaseNPC(CECNPC pNPC)
|
||||
{
|
||||
@@ -111,7 +131,7 @@ public class CECNPCMan : CECObject, IMsgHandler
|
||||
pHost.RemoveObjectFromTabSels(pNPC);
|
||||
|
||||
pNPC.Release();
|
||||
Destroy(pNPC);
|
||||
pNPC.DestroySelf();
|
||||
}
|
||||
}
|
||||
private bool TransmitMessage(ECMSG Msg)
|
||||
@@ -183,6 +203,8 @@ public class CECNPCMan : CECObject, IMsgHandler
|
||||
|
||||
var stateNPC = Convert.ToInt32(msg.dwParam2);
|
||||
var byteArray = (byte[])msg.dwParam1;
|
||||
BMLogger.Log("HoangDev : OnMsgNPCDied " + stateNPC);
|
||||
|
||||
if (stateNPC == CommandID.NPC_DIED)
|
||||
{
|
||||
cmd_npc_died pCmd = EC_Utility.ByteArrayToStructure<cmd_npc_died>(byteArray);
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
using BrewMonster;
|
||||
using CSNetwork;
|
||||
using CSNetwork.GPDataType;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
namespace BrewMonster.Managers
|
||||
{
|
||||
public class EC_HostPlayer : IMsgHandler
|
||||
{
|
||||
public int HandlerId => (int)MANAGER_INDEX.MAN_PLAYER;
|
||||
public bool ProcessMessage(ECMSG Msg)
|
||||
{
|
||||
switch ((int)Msg.dwMsg)
|
||||
{
|
||||
case int value when value == EC_MsgDef.MSG_HST_IVTRINFO:
|
||||
{
|
||||
OnMsgHstIvtrInfo(Msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public void OnMsgHstIvtrInfo(ECMSG Msg)
|
||||
{
|
||||
switch (Convert.ToInt32(Msg.dwParam2))
|
||||
{
|
||||
case CommandID.OWN_IVTR_DATA:
|
||||
{
|
||||
Debug.Log("Chay OWN_IVTR_DATA");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eece34ce0cfd6bc409982ce9b90b263b
|
||||
@@ -121,7 +121,7 @@ namespace PerfectWorld.Scripts.Managers
|
||||
// Store the matter data for later player access
|
||||
matterDataStorage[matterInfo.mid] = matterInfo;
|
||||
|
||||
Debug.Log($"Matter entered world - ID: {matterInfo.mid}, TID: {matterInfo.tid}, Position: {matterInfo.pos}, State: {matterInfo.state}");
|
||||
//Debug.Log($"Matter entered world - ID: {matterInfo.mid}, TID: {matterInfo.tid}, Position: {matterInfo.pos}, State: {matterInfo.state}");
|
||||
|
||||
// Notify pickupItem to create cube for this matter
|
||||
NotifyPickupItem(matterInfo.mid);
|
||||
|
||||
@@ -3,8 +3,8 @@ using UnityEngine;
|
||||
public class CECCounter
|
||||
{
|
||||
// Thuộc tính
|
||||
protected uint m_dwCounter; // Counter
|
||||
protected uint m_dwPeriod; // Count period
|
||||
protected float m_dwCounter; // Counter
|
||||
protected float m_dwPeriod; // Count period
|
||||
|
||||
// Constructor
|
||||
public CECCounter()
|
||||
@@ -14,12 +14,12 @@ public class CECCounter
|
||||
}
|
||||
|
||||
// Set / Get period
|
||||
public void SetPeriod(uint dwPeriod) { m_dwPeriod = dwPeriod; }
|
||||
public uint GetPeriod() { return m_dwPeriod; }
|
||||
public void SetPeriod(float dwPeriod) { m_dwPeriod = dwPeriod; }
|
||||
public float GetPeriod() { return m_dwPeriod; }
|
||||
|
||||
// Set / Get counter
|
||||
public void SetCounter(uint dwCounter) { m_dwCounter = dwCounter; }
|
||||
public uint GetCounter() { return m_dwCounter; }
|
||||
public void SetCounter(float dwCounter) { m_dwCounter = dwCounter; }
|
||||
public float GetCounter() { return m_dwCounter; }
|
||||
|
||||
// Has counter reached period ?
|
||||
public bool IsFull()
|
||||
@@ -34,14 +34,14 @@ public class CECCounter
|
||||
}
|
||||
|
||||
// Increase counter
|
||||
public bool IncCounter(uint dwCounter)
|
||||
public bool IncCounter(float dwCounter)
|
||||
{
|
||||
m_dwCounter += dwCounter;
|
||||
return (m_dwCounter >= m_dwPeriod);
|
||||
}
|
||||
|
||||
// Decrease counter
|
||||
public void DecCounter(uint dwCounter)
|
||||
public void DecCounter(float dwCounter)
|
||||
{
|
||||
if (m_dwCounter <= dwCounter)
|
||||
m_dwCounter = 0;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Animancer.Editor;
|
||||
using BrewMonster;
|
||||
using CSNetwork.GPDataType;
|
||||
using ModelRenderer.Scripts.GameData;
|
||||
@@ -38,7 +39,8 @@ public abstract class CECPlayer : CECObject
|
||||
public float m_fScaleBySkill;
|
||||
public int m_iGender; // Gender
|
||||
protected bool m_bFashionMode;
|
||||
|
||||
public bool m_bShowWeapon;
|
||||
private QueueActionEvent queueActionEvent;
|
||||
|
||||
protected int NUM_WEAPON_TYPE = 15;
|
||||
|
||||
@@ -119,6 +121,7 @@ public abstract class CECPlayer : CECObject
|
||||
m_PlayerActions = _default_actions;
|
||||
m_iShape = 0;
|
||||
m_aEquips = new int[(int)IndexOfIteminEquipmentInventory.SIZE_ALL_EQUIPIVTR];
|
||||
queueActionEvent = new QueueActionEvent("",null,false,null);
|
||||
}
|
||||
public void SetUpPlayer()
|
||||
{
|
||||
@@ -432,7 +435,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, pAttack)
|
||||
&& (dwModifier & (uint)MOD.MOD_BEAT_BACK) == 0)
|
||||
{
|
||||
}
|
||||
@@ -503,7 +506,7 @@ public abstract class CECPlayer : CECObject
|
||||
*piAttackTime = 0;*/
|
||||
}
|
||||
}
|
||||
public bool PlayAttackAction(int nAttackSpeed, out int attackTime, ref bool pActFlag)
|
||||
public bool PlayAttackAction(int nAttackSpeed, out int attackTime, CECAttackEvent attackEvent)
|
||||
{
|
||||
attackTime = 0;
|
||||
|
||||
@@ -536,7 +539,8 @@ public abstract class CECPlayer : CECObject
|
||||
szAct = EC_Utility.BuildActionName(action, 0, "Æð");
|
||||
EventBus.PublishChannel(m_PlayerInfo.cid, new PlayActionEvent(szAct));
|
||||
szAct = EC_Utility.BuildActionName(action, 0, "Âä");
|
||||
EventBus.PublishChannel(m_PlayerInfo.cid, new QueueActionEvent(szAct, ref pActFlag,true));
|
||||
queueActionEvent.SetData(szAct, SetApplyDamage, true, attackEvent);
|
||||
EventBus.PublishChannelClass(m_PlayerInfo.cid, queueActionEvent);
|
||||
//PlayNonSkillActionWithName(iAction, szAct, true, 200, true, ref pActFlag, COMACT_FLAG_MODE_ONCE_MULTIIGNOREGFX);gagága
|
||||
/*
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
@@ -595,7 +599,8 @@ public abstract class CECPlayer : CECObject
|
||||
// ==============================
|
||||
PLAYER_ACTION stand_action = m_PlayerActions[(int)PLAYER_ACTION_TYPE.ACT_FIGHTSTAND];
|
||||
szAct = EC_Utility.BuildActionName(stand_action, 0);
|
||||
EventBus.PublishChannel(m_PlayerInfo.cid, new QueueActionEvent(szAct, ref pActFlag,false));
|
||||
queueActionEvent.SetData(szAct, SetApplyDamage, false, attackEvent);
|
||||
EventBus.PublishChannelClass(m_PlayerInfo.cid, queueActionEvent);
|
||||
|
||||
/* QueueNonSkillActionWithName(ACT_FIGHTSTAND, szAct, 300, false, bHideFX, true);
|
||||
|
||||
@@ -626,7 +631,10 @@ public abstract class CECPlayer : CECObject
|
||||
|
||||
return true;
|
||||
}
|
||||
public bool m_bShowWeapon;
|
||||
public void SetApplyDamage(bool isApplyDamage , CECAttackEvent cECAttackEvent)
|
||||
{
|
||||
cECAttackEvent.m_bSignaled = isApplyDamage;
|
||||
}
|
||||
public void ShowWeaponByConfig(PLAYER_ACTION_INFO_CONFIG p)
|
||||
{
|
||||
m_bShowWeapon = p.hide_weapon != 0 ? false : true;
|
||||
@@ -797,16 +805,25 @@ public struct PlayActionEvent
|
||||
}
|
||||
}
|
||||
|
||||
public struct QueueActionEvent
|
||||
public class QueueActionEvent
|
||||
{
|
||||
public string AnimationName;
|
||||
public bool PActFlag;
|
||||
public Action<bool, CECAttackEvent> SetFlag;
|
||||
public CECAttackEvent AttackEvent;
|
||||
public bool IsHitAnim;
|
||||
public QueueActionEvent(string animationName, ref bool pActFlag, bool isHitAnim)
|
||||
public QueueActionEvent(string animationName, Action<bool,CECAttackEvent> setFlag, bool isHitAnim , CECAttackEvent attackEvent )
|
||||
{
|
||||
this.AnimationName = animationName;
|
||||
PActFlag = pActFlag;
|
||||
SetFlag = setFlag;
|
||||
IsHitAnim = isHitAnim;
|
||||
AttackEvent = attackEvent;
|
||||
}
|
||||
public void SetData(string animationName, Action<bool, CECAttackEvent> setFlag, bool isHitAnim, CECAttackEvent attackEvent)
|
||||
{
|
||||
this.AnimationName = animationName;
|
||||
SetFlag = setFlag;
|
||||
IsHitAnim = isHitAnim;
|
||||
AttackEvent = attackEvent;
|
||||
}
|
||||
}
|
||||
[Serializable]
|
||||
|
||||
@@ -32,9 +32,18 @@ public class CECModel
|
||||
public bool QueueAction(CECNPC.INFO iNFO, int nChannel, string szActName, ref bool pNewActFlag, int nTransTime, uint dwUserData/* 0 */, bool bForceStopPrevAct, bool bCheckTailDup, bool bNoFx, bool bResetSpeed
|
||||
/*joslian*/, bool bResetActFlag, uint dwNewFlagMode)
|
||||
{
|
||||
EventBus.PublishChannel(iNFO.nid, new QueueActionEvent(szActName, ref pNewActFlag, false));
|
||||
|
||||
EventBus.PublishChannel(iNFO.nid, new QueueNPCActionEvent(szActName));
|
||||
return true;
|
||||
}
|
||||
public struct QueueNPCActionEvent
|
||||
{
|
||||
public string AnimationName;
|
||||
public QueueNPCActionEvent(string animationName)
|
||||
{
|
||||
AnimationName = animationName;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Action channel
|
||||
public enum ActionChannel
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CECNPC : CECObject
|
||||
protected int m_iCurWorkType;
|
||||
protected int m_iCurWork;
|
||||
protected uint m_nPolicyActionIntervalTimer;
|
||||
protected CECCounter m_DisappearCnt= new CECCounter();
|
||||
protected CECCounter m_DisappearCnt = new CECCounter();
|
||||
protected CECCounter m_TransCnt = new CECCounter();
|
||||
protected int m_StartDisappearCnt;
|
||||
protected bool m_bAboutToDie;
|
||||
@@ -42,7 +42,7 @@ public class CECNPC : CECObject
|
||||
protected ROLEEXTPROP m_ExtProps;
|
||||
protected CECNPCModelPolicy m_pNPCModelPolicy;
|
||||
protected CECPolicyAction m_pPolicyAction;
|
||||
public int m_iMMIndex;
|
||||
public int m_iMMIndex;
|
||||
[SerializeField] protected float m_fMoveSpeed;
|
||||
[SerializeField] protected CharacterController _characterController;
|
||||
|
||||
@@ -162,9 +162,9 @@ public class CECNPC : CECObject
|
||||
if (IsDisappearing())
|
||||
{
|
||||
// When m_DisappearCnt passed half length, start changing model's transparence
|
||||
uint dwOldCnt = m_DisappearCnt.GetCounter();
|
||||
m_DisappearCnt.IncCounter((uint)Time.deltaTime * 1000);
|
||||
uint dwHalf = m_DisappearCnt.GetPeriod() / 2;
|
||||
float dwOldCnt = m_DisappearCnt.GetCounter();
|
||||
m_DisappearCnt.IncCounter(Time.deltaTime * 1000);
|
||||
float dwHalf = m_DisappearCnt.GetPeriod() / 2;
|
||||
|
||||
if (dwOldCnt < dwHalf && m_DisappearCnt.GetCounter() >= dwHalf)
|
||||
StartAdjustTransparency(-1.0f, 1.0f, dwHalf);
|
||||
@@ -174,6 +174,10 @@ public class CECNPC : CECObject
|
||||
StartAdjustTransparency(-1.0f, GetTransparentLimit(), 500);
|
||||
}
|
||||
}
|
||||
public void DestroySelf()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
float GetTransparentLimit()
|
||||
{
|
||||
if ((m_dwStates & (uint)PlayerNPCState.GP_STATE_INVISIBLE) != 0)
|
||||
@@ -187,7 +191,7 @@ public class CECNPC : CECObject
|
||||
|
||||
return -1.0f;
|
||||
}
|
||||
bool StartAdjustTransparency(float fCur, float fDest, uint dwTime)
|
||||
bool StartAdjustTransparency(float fCur, float fDest, float dwTime)
|
||||
{
|
||||
// use current value for starting
|
||||
/*if (fCur < 0.0f)
|
||||
@@ -233,7 +237,7 @@ public class CECNPC : CECObject
|
||||
//RebuildTraceBrush();
|
||||
}
|
||||
}
|
||||
public void Release()
|
||||
public void Release()
|
||||
{
|
||||
// Release current skill if it exists
|
||||
/* if (m_pCurSkill)
|
||||
@@ -277,13 +281,13 @@ public class CECNPC : CECObject
|
||||
m_pPolicyAction = null;
|
||||
m_nPolicyActionIntervalTimer = 0;
|
||||
|
||||
/* for (MOEffectMAP::iterator it = m_mapMOEffect.begin(); it != m_mapMOEffect.end(); ++it)
|
||||
{
|
||||
A3DGFXExMan* pGFXExMan = g_pGame->GetA3DGFXExMan();
|
||||
pGFXExMan->CacheReleasedGfx(it->second);
|
||||
}
|
||||
/* for (MOEffectMAP::iterator it = m_mapMOEffect.begin(); it != m_mapMOEffect.end(); ++it)
|
||||
{
|
||||
A3DGFXExMan* pGFXExMan = g_pGame->GetA3DGFXExMan();
|
||||
pGFXExMan->CacheReleasedGfx(it->second);
|
||||
}
|
||||
|
||||
m_mapMOEffect.clear();*/
|
||||
m_mapMOEffect.clear();*/
|
||||
}
|
||||
public bool MovingTo(float deltaTime)
|
||||
{
|
||||
@@ -392,9 +396,9 @@ public class CECNPC : CECObject
|
||||
|
||||
SetUseGroundNormal(true);
|
||||
}
|
||||
public void Disappear()
|
||||
public void Disappear()
|
||||
{
|
||||
// Trigger disappear counting to start
|
||||
BMLogger.Log("CECNPC::Disappear");
|
||||
m_DisappearCnt.SetCounter(1);
|
||||
PlayModelAction((int)NPCActionIndex.ACT_NPC_DISAPPEAR);
|
||||
}
|
||||
@@ -465,7 +469,6 @@ public class CECNPC : CECObject
|
||||
{
|
||||
// Note: below judge can prevent many problems when we attempt to
|
||||
// finish a work but don't assure we are doing this work
|
||||
BrewMonster.BMLogger.Log("HoangDev : WorkFinished :" + iWorkID);
|
||||
if (m_iCurWork != iWorkID)
|
||||
return;
|
||||
|
||||
@@ -885,7 +888,7 @@ public class CECNPC : CECObject
|
||||
|
||||
StartWorkByID(iNewWork, dwParam);
|
||||
}
|
||||
|
||||
public bool ShouldDisappear() { return m_DisappearCnt.IsFull(); }
|
||||
public void StopWork(int iWorkType)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -3,14 +3,13 @@ using BrewMonster;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static CECModel;
|
||||
|
||||
public class NPCVisual : MonoBehaviour
|
||||
{
|
||||
[SerializeField] NamedAnimancerComponent namedAnimancer;
|
||||
protected CECNPC.INFO m_NPCInfo;
|
||||
[SerializeField] private Queue<string> _animationQueue = new Queue<string>();
|
||||
[SerializeField] private bool pActFlag;
|
||||
[SerializeField] private bool isHit;
|
||||
[SerializeField] private AnimancerState _currentState;
|
||||
public CECNPC.INFO GetNPCINFO => m_NPCInfo;
|
||||
#if UNITY_EDITOR
|
||||
@@ -39,26 +38,24 @@ public class NPCVisual : MonoBehaviour
|
||||
BrewMonster.BMLogger.LogError("animancer == null");
|
||||
return;
|
||||
}
|
||||
EventBus.SubscribeChannel<QueueActionEvent>(m_NPCInfo.nid, OnQueueAction);
|
||||
EventBus.SubscribeChannel<QueueNPCActionEvent>(m_NPCInfo.nid, OnQueueAction);
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
PlayNext();
|
||||
}
|
||||
private void OnQueueAction(QueueActionEvent @event)
|
||||
private void OnQueueAction(QueueNPCActionEvent @event)
|
||||
{
|
||||
if (!EnqueueAnimation(@event))
|
||||
{
|
||||
BMLogger.LogError("HoangDev : EnqueueAnimation Failed");
|
||||
}
|
||||
}
|
||||
public bool EnqueueAnimation(QueueActionEvent @event)
|
||||
public bool EnqueueAnimation(QueueNPCActionEvent @event)
|
||||
{
|
||||
if (namedAnimancer == null) return false;
|
||||
|
||||
_animationQueue.Enqueue(@event.AnimationName);
|
||||
pActFlag = @event.PActFlag;
|
||||
isHit = @event.IsHitAnim;
|
||||
return true;
|
||||
}
|
||||
private void PlayNext()
|
||||
@@ -68,20 +65,10 @@ public class NPCVisual : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
if (_currentState == null) return;
|
||||
if (_currentState.IsPlaying) return;
|
||||
if (isHit)
|
||||
{
|
||||
SetpActFlagTrue();
|
||||
isHit = false;
|
||||
return;
|
||||
}
|
||||
if (_currentState.NormalizedTime < 1f) return;
|
||||
string animName = _animationQueue.Dequeue();
|
||||
_currentState = namedAnimancer.TryPlay(animName);
|
||||
}
|
||||
private void SetpActFlagTrue()
|
||||
{
|
||||
pActFlag = true;
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
EventBus.UnsubscribeAllInChannel(m_NPCInfo.nid);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace CSNetwork
|
||||
private int _currentUserId = -1; // To store the UserID after successful login
|
||||
private int m_iCharID;
|
||||
private int m_idLastSelTarget = 0; // ID of selected item last time
|
||||
|
||||
CECStringTab m_ErrorMsgs;
|
||||
// State management for async operations and callbacks
|
||||
private Action<bool> _loginCallback;
|
||||
private Action<List<RoleInfo>> _roleListCallback;
|
||||
@@ -320,7 +320,6 @@ namespace CSNetwork
|
||||
//sss
|
||||
//BMLogger.LogError($"### GameDataSend: CMDID {pCmdHeader}");
|
||||
int iHostID = _selectedRole.roleid;
|
||||
BMLogger.LogError("HoangDev: pCmdHeader: " + pCmdHeader);
|
||||
_logger.Info($"### GameDataSend: " + pCmdHeader);
|
||||
|
||||
switch (pCmdHeader)
|
||||
@@ -434,6 +433,63 @@ namespace CSNetwork
|
||||
|
||||
case CommandID.ERROR_MESSAGE:
|
||||
_logger.Info($"### GameDataSend: ERROR_MESSAGE: {BitConverter.ToInt32(pDataBuf, 0)}");
|
||||
cmd_error_msg pCmd = GPDataTypeHelper.FromBytes<cmd_error_msg>(pDataBuf);
|
||||
BMLogger.LogError("hOANGdEV : ERROR_MESSAGE pCmd.iMessage!=0 " + pCmd.iMessage);
|
||||
|
||||
if (pCmd.iMessage!=0)
|
||||
{
|
||||
|
||||
string szMsg = m_ErrorMsgs.GetWideString(pCmd.iMessage);
|
||||
if (string.IsNullOrEmpty( szMsg))
|
||||
BMLogger.LogError("SERVER - unknown error !");
|
||||
//else if (pCmd.iMessage != 2)
|
||||
//g_pGame->GetGameRun()->AddChatMessage(szMsg, GP_CHAT_MISC);
|
||||
|
||||
}
|
||||
|
||||
if (pCmd.iMessage == 2)
|
||||
{
|
||||
|
||||
// Attack target is too far
|
||||
//pGameRun->PostMessage(MSG_HST_TARGETISFAR, MAN_PLAYER, 0, (DWORD)pDataBuf, pCmdHeader->cmd);
|
||||
}
|
||||
else if (pCmd.iMessage == 20)
|
||||
{
|
||||
// Failed to cast skill
|
||||
//pGameRun->PostMessage(MSG_PM_CASTSKILL, MAN_PLAYER, 0, (DWORD)pDataBuf, pCmdHeader->cmd);
|
||||
}
|
||||
else if (pCmd.iMessage == 133 || pCmd.iMessage == 134)
|
||||
{
|
||||
// deal failed
|
||||
//pGameRun->PostMessage(MSG_HST_BUY_SELL_FAIL, MAN_PLAYER, 0, (DWORD)pDataBuf, pCmdHeader->cmd);
|
||||
}
|
||||
else if (pCmd.iMessage == 158)
|
||||
{
|
||||
// µ±Ç°»ãÂʲ»¶Ô£¬ÖØÐÂÈ¡»ãÂÊ
|
||||
//c2s_CmdGetCashMoneyRate();
|
||||
}
|
||||
else if (pCmd.iMessage == 108 /*&& pGameRun->GetHostPlayer()->IsInKingService()*/)
|
||||
{
|
||||
/* CECGameUIMan* pGameUI = pGameRun->GetUIManager()->GetInGameUIMan();
|
||||
if (pGameUI)
|
||||
pGameUI->EndNPCService();*/
|
||||
}
|
||||
else if (pCmd.iMessage == 108 /*&& pGameRun->GetHostPlayer()->GetOfflineShopCtrl()->GetNPCSevFlag() != COfflineShopCtrl::NPCSEV_NULL*/)
|
||||
{
|
||||
/* CECGameUIMan* pGameUI = pGameRun->GetUIManager()->GetInGameUIMan();
|
||||
if (pGameUI)
|
||||
pGameUI->EndNPCService();*/
|
||||
}
|
||||
else if (pCmd.iMessage == 175)
|
||||
{
|
||||
//c2s_CmdQueryParallelWorld();
|
||||
}
|
||||
else if (pCmd.iMessage == 6)
|
||||
{
|
||||
//AP_ActionEvent(AP_EVENT_CANNOTPICKUP);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
case CommandID.SELECT_TARGET:
|
||||
case CommandID.UNSELECT:
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace BrewMonster
|
||||
private void Update()
|
||||
{
|
||||
EC_ManMessage.Tick();
|
||||
_CECNPCMan.Tick();
|
||||
}
|
||||
|
||||
// Get object by specified ID
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace BrewMonster.UI
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.Tab))
|
||||
{
|
||||
_usernameInputField.text = "test025";
|
||||
_usernameInputField.text = "test002";
|
||||
_passwordInputField.text = "123456";
|
||||
OnLoginButtonClicked();
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ public class PlayerVisual : MonoBehaviour
|
||||
|
||||
[SerializeField] private AnimancerState _currentState;
|
||||
[SerializeField] private Queue<string> _animationQueue = new Queue<string>();
|
||||
[SerializeField] private bool pActFlag;
|
||||
[SerializeField] private bool isHit;
|
||||
|
||||
QueueActionEvent queueActionEvent;
|
||||
|
||||
private void PlayActionEventHandler(PlayActionEvent @event)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ public class PlayerVisual : MonoBehaviour
|
||||
}
|
||||
_playerInfo = player.GetPlayInfo();
|
||||
EventBus.SubscribeChannel<PlayActionEvent>(_playerInfo.cid, PlayActionEventHandler);
|
||||
EventBus.SubscribeChannel<QueueActionEvent>(_playerInfo.cid, QueueActionEventHandler);
|
||||
EventBus.SubscribeChannelClass<QueueActionEvent>(_playerInfo.cid, QueueActionEventHandler);
|
||||
}
|
||||
|
||||
private void QueueActionEventHandler(QueueActionEvent @event)
|
||||
@@ -58,11 +58,12 @@ public class PlayerVisual : MonoBehaviour
|
||||
public bool EnqueueAnimation(QueueActionEvent @event)
|
||||
{
|
||||
if (namedAnimancer == null) return false;
|
||||
BMLogger.LogError("HoangDev : @event.PActFlag1 :" + @event.PActFlag);
|
||||
|
||||
queueActionEvent = @event;
|
||||
_animationQueue.Enqueue(@event.AnimationName);
|
||||
pActFlag = @event.PActFlag;
|
||||
isHit = @event.IsHitAnim;
|
||||
if (!isHit)
|
||||
{
|
||||
isHit = @event.IsHitAnim;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void PlayNext()
|
||||
@@ -71,22 +72,20 @@ public class PlayerVisual : MonoBehaviour
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(_currentState == null) return;
|
||||
if(_currentState.IsPlaying) return;
|
||||
if(isHit)
|
||||
if (_currentState == null) return;
|
||||
if (_currentState.NormalizedTime < 1f) return;
|
||||
if (isHit)
|
||||
{
|
||||
SetpActFlagTrue();
|
||||
isHit = false;
|
||||
return;
|
||||
ApplyDamage();
|
||||
}
|
||||
string animName = _animationQueue.Dequeue();
|
||||
_currentState = namedAnimancer.TryPlay(animName);
|
||||
|
||||
}
|
||||
private void SetpActFlagTrue()
|
||||
void ApplyDamage()
|
||||
{
|
||||
pActFlag = true;
|
||||
BMLogger.LogError("HoangDev : SetpActFlagTrue :");
|
||||
|
||||
isHit = false;
|
||||
queueActionEvent.SetFlag(true, queueActionEvent.AttackEvent);
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
|
||||
+165
-327
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user