private void OnDamage(int receiver, int caster, bool isNormalDamage, bool isCritical, int hpDamage, int npDamage) { if (receiver == LeaderID && caster > 0) { bool newSelect = true; if (null != SelectedTarget) { EntityInfo curTarget = GetEntityById(ClientModule.Instance.SelectedTarget.TargetId); if (curTarget == SelectedTarget.Target) { newSelect = false; } } if (newSelect) { SetLockTarget(caster); } } EntityInfo entity = GetEntityById(receiver); EntityInfo casterNpc = GetEntityById(caster); while (null != casterNpc && casterNpc.SummonerId > 0) { casterNpc = GetEntityById(casterNpc.SummonerId); if (null != casterNpc) { caster = casterNpc.GetId(); } } if (null != entity) { if (hpDamage != 0) { float hp = (float)entity.Hp / entity.GetActualProperty().HpMax; Utility.EventSystem.Publish("ui_actor_hp", "ui", entity.GetId(), hp); //if (receiver == LeaderID || caster == LeaderID) { Utility.EventSystem.Publish("ui_show_hp_num", "ui", entity.GetId(), -hpDamage); //} if (caster == LeaderID) { EntityViewModel view = EntityController.Instance.GetEntityViewById(receiver); if (view != null) { view.SetRedEdge(1.0f); } } } if (npDamage != 0) { float mp = (float)entity.Energy / entity.GetActualProperty().EnergyMax; Utility.EventSystem.Publish("ui_actor_mp", "ui", entity.GetId(), mp, -npDamage); //ClientModuleUtility.EventSystem.Publish("ui_show_mp_num", "ui", entity.GetId(), -npDamage); } } }
static public int SetRedEdge(IntPtr l) { try { GameFramework.EntityViewModel self = (GameFramework.EntityViewModel)checkSelf(l); System.Single a1; checkType(l, 2, out a1); self.SetRedEdge(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }