HPMP变化事件
This commit is contained in:
parent
0581bf8548
commit
89a2460de1
@ -100,6 +100,8 @@ namespace Game
|
|||||||
UnderAttack.BaseData.life.curHP -= DamageHP;
|
UnderAttack.BaseData.life.curHP -= DamageHP;
|
||||||
UnderAttack.BaseData.life.curHP = Math.Max(UnderAttack.BaseData.life.curHP, 0);
|
UnderAttack.BaseData.life.curHP = Math.Max(UnderAttack.BaseData.life.curHP, 0);
|
||||||
|
|
||||||
|
AppEntry.Event.Fire(null, HPMPChangeEventArgs.Create(UnderAttack.RoleType, UnderAttack.RoleID));
|
||||||
|
|
||||||
if (UnderAttack.BaseData.life.curHP > 0)
|
if (UnderAttack.BaseData.life.curHP > 0)
|
||||||
UnderAttack.Anime.PlayHit();
|
UnderAttack.Anime.PlayHit();
|
||||||
else
|
else
|
||||||
|
32
Assets/Scripts/Main/Event/BattleEvent/HPMPChangeEventArgs.cs
Normal file
32
Assets/Scripts/Main/Event/BattleEvent/HPMPChangeEventArgs.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using Axibug;
|
||||||
|
using Axibug.Event;
|
||||||
|
|
||||||
|
namespace Game
|
||||||
|
{
|
||||||
|
public class HPMPChangeEventArgs : LogicEventArgs
|
||||||
|
{
|
||||||
|
public static readonly int EventId = typeof(HPMPChangeEventArgs).GetHashCode();
|
||||||
|
|
||||||
|
public E_NODE_TYPE roleType = E_NODE_TYPE.N_FREE;
|
||||||
|
public int RoleID = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取加载数据表成功事件编号。
|
||||||
|
/// </summary>
|
||||||
|
public override int Id { get { return EventId; } }
|
||||||
|
|
||||||
|
public static HPMPChangeEventArgs Create(E_NODE_TYPE type,int roleID)
|
||||||
|
{
|
||||||
|
HPMPChangeEventArgs s = ReferencePool.Acquire<HPMPChangeEventArgs>();
|
||||||
|
s.RoleID = roleID;
|
||||||
|
s.roleType = type;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Clear()
|
||||||
|
{
|
||||||
|
roleType = E_NODE_TYPE.N_FREE;
|
||||||
|
RoleID = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a03fb589092408848b244a23325483ad
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -10,6 +10,8 @@ using UnityEngine.UI;
|
|||||||
using Game;
|
using Game;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using Axibug.Runtime;
|
using Axibug.Runtime;
|
||||||
|
using Axibug.Event;
|
||||||
|
using Axibug;
|
||||||
|
|
||||||
namespace Game
|
namespace Game
|
||||||
{
|
{
|
||||||
@ -43,6 +45,7 @@ namespace Game
|
|||||||
//UIAutoBuild_EventReg
|
//UIAutoBuild_EventReg
|
||||||
//UIAutoBuild_EventReg
|
//UIAutoBuild_EventReg
|
||||||
Reflush();
|
Reflush();
|
||||||
|
AppEntry.Event.Subscribe(HPMPChangeEventArgs.EventId, OnHPMPChangeEventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDisable()
|
void OnDisable()
|
||||||
@ -55,6 +58,20 @@ namespace Game
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 事件
|
||||||
|
|
||||||
|
private void OnHPMPChangeEventArgs(object sender, LogicEventArgs e)
|
||||||
|
{
|
||||||
|
HPMPChangeEventArgs msg = (HPMPChangeEventArgs)e;
|
||||||
|
if (msg == null) throw new GameException("OnHPMPChangeEventArgs is null");
|
||||||
|
if (msg.RoleID == GamePlayEntry.MainPlayer.Player.RoleID)
|
||||||
|
{
|
||||||
|
Reflush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
// 每次显示都执行, 可定义参数
|
// 每次显示都执行, 可定义参数
|
||||||
public override void Show(params object[] _params)
|
public override void Show(params object[] _params)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user