From dbb4ea01211573e782666e45eb859c96859b2cd6 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 29 八月 2025 15:59:32 +0800
Subject: [PATCH] 125 【战斗】战斗系统 ui上的一点修正

---
 Main/System/Battle/UIComp/BasicHeroInfoContainer.cs |    8 +++++++-
 Main/System/Battle/BattleObject/BattleObject.cs     |    4 ++--
 Main/System/Battle/UIComp/BattleHeroInfoBar.cs      |   14 ++++++++++++++
 Main/System/Team/TeamHero.cs                        |    6 ++++++
 4 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index eb2ad49..6299053 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -90,7 +90,6 @@
 
         renderers = heroGo.GetComponentsInChildren<Renderer>(true);
 
-        Debug.LogError("YYL---1");
         heroInfoBar = heroGo.GetComponentInChildren<BattleHeroInfoBar>(true);
         heroInfoBar.SetBattleObject(this);
     }
@@ -99,7 +98,6 @@
     public virtual void Run()
     {
         motionBase.Run();
-        Debug.LogError("YYL---2");
         heroInfoBar.Run();
     }
 
@@ -142,6 +140,8 @@
                 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:
diff --git a/Main/System/Battle/UIComp/BasicHeroInfoContainer.cs b/Main/System/Battle/UIComp/BasicHeroInfoContainer.cs
index 0ee0b41..8f7c1eb 100644
--- a/Main/System/Battle/UIComp/BasicHeroInfoContainer.cs
+++ b/Main/System/Battle/UIComp/BasicHeroInfoContainer.cs
@@ -1,9 +1,15 @@
 using UnityEngine;
+using UnityEngine.UI;
 
 public class BasicHeroInfoContainer : MonoBehaviour
 {
+    public Text txtLvName;
+
+    public Image countryIcon;
+
     public void SetHeroInfo(TeamHero teamHero)
     {
-
+        txtLvName.text = string.Format("Lv.{0} {1}", teamHero.level, teamHero.name);
+        countryIcon.SetSprite(HeroUIManager.Instance.GetCountryIconName((int)teamHero.Country));
     }
 }
\ No newline at end of file
diff --git a/Main/System/Battle/UIComp/BattleHeroInfoBar.cs b/Main/System/Battle/UIComp/BattleHeroInfoBar.cs
index 2f2a30f..ffdb74d 100644
--- a/Main/System/Battle/UIComp/BattleHeroInfoBar.cs
+++ b/Main/System/Battle/UIComp/BattleHeroInfoBar.cs
@@ -28,6 +28,8 @@
 
     protected Tween hpTween;
 
+    protected Tween xpTween;
+
     protected List<BattleTips> tipsList = new List<BattleTips>();
 
     protected List<HB428_tagSCBuffRefresh> buffList = new List<HB428_tagSCBuffRefresh>();
@@ -63,6 +65,7 @@
 
     protected void OnDisable()
     {
+        scroller.OnRefreshCell -= OnRefreshCell;     
         //  TODO YYL 鑰冭檻姹犲寲
         messages.Clear();
         for (int i = 0; i < tipsList.Count; i++)
@@ -123,6 +126,17 @@
         battleObject.battleField.battleTweenMgr.OnPlayTween(hpTween);
     }
 
+    public void UpdateXP(long fromXp, long toXp, long maxXp)
+    {
+        //  鍋歑p澧炲姞鎴栬�呭噺灏戠殑鍔ㄧ敾
+        // sliderXp.value = ((float)fromXp) / ((float)maxXp);
+        if (xpTween != null)
+        {
+            battleObject.battleField.battleTweenMgr.OnKillTween(xpTween);
+        }
+        xpTween = sliderHp.DOValue((float)toXp / maxXp, 0.2f);
+        battleObject.battleField.battleTweenMgr.OnPlayTween(xpTween);
+    }
 
     public void Run()
     {
diff --git a/Main/System/Team/TeamHero.cs b/Main/System/Team/TeamHero.cs
index e8c2ce7..2c11b2a 100644
--- a/Main/System/Team/TeamHero.cs
+++ b/Main/System/Team/TeamHero.cs
@@ -13,6 +13,8 @@
 
     public int level = 0;
 
+    public string name;
+
     public TeamBase teamBase
     {
         get; private set;
@@ -53,6 +55,8 @@
             Country = (HeroCountry)heroConfig.Country;
             SkinID = (int)fightObj.SkinID;
             modelScale = 1f;
+            name = heroConfig.Name;
+
         }
         else if (fightObj.NPCID > 0)
         {
@@ -61,6 +65,8 @@
             Country = (HeroCountry)npcConfig.Country;
             SkinID = npcConfig.SkinID;
             modelScale = npcConfig.ModelScale;
+            name = npcConfig.NPCName;
+            
         }
         else
         {

--
Gitblit v1.8.0