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 | 59 ++++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 38 insertions(+), 21 deletions(-)
diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index e094fb1..110afc0 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -52,6 +52,7 @@
private RectTransform m_heroRectTrans;
+
public RectTransform heroRectTrans
{
get
@@ -68,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)
{
@@ -89,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()
@@ -129,16 +138,20 @@
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:
- BattleDebug.LogError("BattleObject.ObjInfoRefresh 鍑虹幇鎰忓绫诲瀷 " + _refreshInfo.RefreshType.ToString());
+ Debug.LogError("BattleObject.ObjInfoRefresh 鍑虹幇鎰忓绫诲瀷 " + _refreshInfo.RefreshType.ToString());
break;
}
}
@@ -226,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)
+ {
+
}
// 闂伩寮�濮�
@@ -261,14 +284,13 @@
public virtual void OnDeath(Action _onDeathAnimationComplete)
{
- BattleDebug.LogError(ObjID + " OnDeath called");
onDeathAnimationComplete = _onDeathAnimationComplete;
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();
@@ -291,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()
@@ -338,7 +353,7 @@
public void PerformDrop()
{
- if (null == battleDrops)
+ if (null == battleDrops || battleDrops.dropItemPackIndex.Count == 0)
return;
EventBroadcast.Instance.Broadcast<string, BattleDrops, Action>(
@@ -352,6 +367,8 @@
+
+
#if UNITY_EDITOR_STOP_USING
public void EditorRevive()
{
--
Gitblit v1.8.0