From a80d9e64b60403c71ff7ff32c9e94e6833f50ace Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期三, 10 九月 2025 22:28:26 +0800
Subject: [PATCH] 0312 优化删除物品的通知
---
Main/System/Battle/BattleObject/BattleObject.cs | 79 ++++++++++++++++++++++++++-------------
1 files changed, 53 insertions(+), 26 deletions(-)
diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index 3abc1aa..110afc0 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -48,7 +48,10 @@
private set;
}
+ protected BattleDrops battleDrops;
+
private RectTransform m_heroRectTrans;
+
public RectTransform heroRectTrans
{
@@ -66,9 +69,8 @@
protected Renderer[] renderers;
- public Transform effectNode;
-
private List<HB405_tagMCAddExp> hB405_tagMCAddExps = new List<HB405_tagMCAddExp>();
+ public BattleHeroInfoBar heroInfoBar;
public BattleObject(BattleField _battleField)
{
@@ -87,13 +89,22 @@
buffMgr.Init(this);
renderers = heroGo.GetComponentsInChildren<Renderer>(true);
- }
+ heroInfoBar = heroGo.GetComponentInChildren<BattleHeroInfoBar>(true);
+ heroInfoBar.SetBattleObject(this);
+
+ // 鏍规嵁闃佃惀缈昏浆琛�鏉�
+ var heroInfoBarScale = heroInfoBar.transform.localScale;
+ heroInfoBarScale.x *= Camp == BattleCamp.Red ? 1 : -1;
+ heroInfoBar.transform.localScale = heroInfoBarScale;
+
+ }
public virtual void Run()
{
motionBase.Run();
+ heroInfoBar.Run();
}
public virtual void Pause()
@@ -108,7 +119,6 @@
public virtual void Destroy()
{
-
motionBase.onAnimationComplete -= OnAnimationComplete;
motionBase.Release();
@@ -128,12 +138,16 @@
switch ((PlayerDataType)_refreshInfo.RefreshType)
{
case PlayerDataType.HP:
+ long toHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
+ heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp);
teamHero.curHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
break;
case PlayerDataType.MaxHP:
teamHero.maxHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
break;
case PlayerDataType.XP:
+ long toXp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
+ heroInfoBar.UpdateHP(teamHero.rage, toXp, 100);
teamHero.rage = (int)GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
break;
default:
@@ -225,14 +239,24 @@
return true;
}
- public virtual void Hurt(List<long> damageValues, long _totalDamage, uint attackType)
+ public virtual void Hurt(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig)
{
- PopDamage(teamHero.curHp, damageValues, attackType);
+ PopDamage(damageValues, hurt, skillConfig);
motionBase.PlayAnimation(MotionName.hit, false);
- // 鎵h
+ // 鎵h娴佺粰鍒殑鏁屾柟鍒锋柊濂戒簡
teamHero.curHp -= _totalDamage;
+ }
+
+ public void SuckHp(uint suckHP, SkillConfig skillConfig)
+ {
+
+ }
+
+ public void HurtByReflect(uint bounceHP, SkillConfig skillConfig)
+ {
+
}
// 闂伩寮�濮�
@@ -264,9 +288,9 @@
motionBase.PlayAnimation(MotionName.dead, false);
}
- protected virtual void OnAnimationComplete(MotionName motionName)
+ protected virtual void OnAnimationComplete(string motionName)
{
- if (motionName == MotionName.dead)
+ if (motionName == MotionName.dead.ToString().ToLower())
{
OnDeadAnimationComplete();
onDeathAnimationComplete?.Invoke();
@@ -289,19 +313,12 @@
}
// 浼ゅ杩樿鐪� 鏄惁闂伩 鏆村嚮 and so on 闇�瑕佹湁涓�涓狣amageType 鏈嶅姟鍣ㄥ簲璇ヤ細缁�
- protected virtual void PopDamage(long curHp, List<long> damageValues, uint attackType)
+ protected virtual void PopDamage(List<long> damageValues, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig)
{
- // 鍏跺疄搴旇閫氱煡鍑哄幓缁橴I鐣岄潰瑙h�� 璁︰I鐣岄潰鑷繁鏉ユ樉绀虹殑 YYL TODO
- // 鎾斁浼ゅ鏁板瓧
- // 杩欓噷鍙互瀹炵幇涓�涓激瀹虫暟瀛楃殑寮瑰嚭鏁堟灉
- // 姣斿浣跨敤涓�涓猆I缁勪欢鏉ユ樉绀轰激瀹虫暟瀛�
- foreach (var damage in damageValues)
- {
- Debug.Log($"Damage: {damage}");
- }
+ BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, hurt, skillConfig);
// YYL TODO 鏄惁闇�瑕佹寕鍦ㄥ湪鑷韩鐨刦ollow鐐逛笂
- EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleField.guid, this, damageValues);
+ EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
}
public RectTransform GetAliasTeamNode()
@@ -324,22 +341,32 @@
// YYL TODO
// 浼戞伅鐘舵��
// 澶氫竴涓獄zz鐨勪竴涓壒鏁�
-
+ heroGo.SetActive(true);
motionBase.PlayAnimation(MotionName.idle, true);
+ heroRectTrans.anchoredPosition = Vector2.zero;
}
- public void PushExpPackList(List<HB405_tagMCAddExp> _hB405_tagMCAddExps)
+ public void PushDropItems(BattleDrops _battleDrops)
{
- // YYL TODO 姝讳骸鍚庡脊鍑虹粡楠屾帀钀芥彁閱�
- hB405_tagMCAddExps = _hB405_tagMCAddExps;
+ battleDrops = _battleDrops;
}
- public void DropExp()
+ public void PerformDrop()
{
- // YYL TODO
- // hB405_tagMCAddExps
+ if (null == battleDrops || battleDrops.dropItemPackIndex.Count == 0)
+ return;
+
+ EventBroadcast.Instance.Broadcast<string, BattleDrops, Action>(
+ EventName.BATTLE_DROP_ITEMS, battleField.guid, battleDrops, OnPerformDropFinish);
}
+ protected void OnPerformDropFinish()
+ {
+ battleDrops = null;
+ }
+
+
+
#if UNITY_EDITOR_STOP_USING
--
Gitblit v1.8.0