From 0e3029a3dc4375c7eab8de9ccf07b5a2595c0070 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期日, 24 八月 2025 00:05:59 +0800
Subject: [PATCH] 117 【武将】武将系统 - 武将属性查看,非主线上阵武将战力提升显示

---
 Main/System/HeroUI/HeroLVBreakWin.cs               |   15 +++++++
 Main/System/Main/PlayerMainDate.cs                 |   49 +++++++++++++++---------
 Main/System/HeroUI/HeroAllAttrWin.cs               |    5 +-
 Main/System/Main/FightPowerManager.cs              |   30 +++++++++++++++
 Main/Config/PartialConfigs/PlayerPropertyConfig.cs |    2 
 Main/System/HeroUI/HeroTrainWin.cs                 |   13 +++++-
 Main/System/HeroUI/HeroUIManager.cs                |    4 +-
 7 files changed, 90 insertions(+), 28 deletions(-)

diff --git a/Main/Config/PartialConfigs/PlayerPropertyConfig.cs b/Main/Config/PartialConfigs/PlayerPropertyConfig.cs
index f7014ae..c137e4c 100644
--- a/Main/Config/PartialConfigs/PlayerPropertyConfig.cs
+++ b/Main/Config/PartialConfigs/PlayerPropertyConfig.cs
@@ -107,7 +107,7 @@
 
     public static string GetValueDescription(int id, long value)
     {
-        return GetValueDescription(id, value, false);
+        return GetValueDescription(id, value, true);
     }
 
     public static string GetValueDescription(int id, long value, bool largeValue)
diff --git a/Main/System/HeroUI/HeroAllAttrWin.cs b/Main/System/HeroUI/HeroAllAttrWin.cs
index cd582d7..a8c650a 100644
--- a/Main/System/HeroUI/HeroAllAttrWin.cs
+++ b/Main/System/HeroUI/HeroAllAttrWin.cs
@@ -107,7 +107,7 @@
         var hero = HeroManager.Instance.GetHero(item.guid);
         if (hero == null)
             return;
-
+        var dict = FightPowerManager.Instance.GetHeroTotalAttr(hero);
         foreach (var kv in attrBtns)
         {
             //姣忎釜鎸夐挳涓嬫湁涓や釜Text锛歯ame 鍜� value
@@ -117,7 +117,8 @@
             Text valueText = button.transform.Find("value").GetComponent<Text>();
 
             nameText.text = PlayerPropertyConfig.Get(id).ShowName;
-            valueText.text = PlayerPropertyConfig.GetValueDescription(id, 123);
+            var value = dict.TryGetValue(id, out long v) ? v : 0;
+            valueText.text = PlayerPropertyConfig.GetValueDescription(id, value);
         }
     }
 
diff --git a/Main/System/HeroUI/HeroLVBreakWin.cs b/Main/System/HeroUI/HeroLVBreakWin.cs
index 015731a..d63ffd4 100644
--- a/Main/System/HeroUI/HeroLVBreakWin.cs
+++ b/Main/System/HeroUI/HeroLVBreakWin.cs
@@ -76,11 +76,23 @@
         List<string> attrStrArr = new List<string>();
         for (int i = 0; i < nextQualityBreakConfig.AttrIDList.Length; i++)
         {
+            if (nextQualityBreakConfig.AttrIDList[i] == 0)
+            {
+                continue;
+            }
             attrStrArr.Add(PlayerPropertyConfig.GetFullDescription(nextQualityBreakConfig.AttrIDList[i], nextQualityBreakConfig.AttrValueList[i]));
         }
         if (nextQualityBreakConfig.SkillID != 0)
         {
-            attrStrArr.Add(SkillConfig.Get(nextQualityBreakConfig.SkillID)?.Description);
+            var skill = SkillConfig.Get(nextQualityBreakConfig.SkillID);
+            if (skill != null)
+            {
+                attrStrArr.Add(skill.Description);
+            }
+            else
+            { 
+                Debug.LogError("鏈厤缃妧鑳�" + nextQualityBreakConfig.SkillID);
+            }
         }
         potentialText.text = Language.Get("L1100", Language.Get("herocard56"), string.Join(Language.Get("L1112"), attrStrArr));
     }
@@ -92,6 +104,7 @@
             var pack = new CB232_tagCSHeroBreak();
             pack.ItemIndex = (ushort)hero.itemHero.gridIndex;
             GameNetSystem.Instance.SendInfo(pack);
+            HeroUIManager.Instance.lastFightPower = new KeyValuePair<int, long>(hero.heroId, hero.CalculatePower(false));
             CloseWindow();
             //璁剧疆涓瓑寰呭洖澶嶇殑鏍囪瘑 鏄剧ず鎴愬姛鐣岄潰
             HeroUIManager.Instance.waitResponse = new WaitHeroFuncResponse()
diff --git a/Main/System/HeroUI/HeroTrainWin.cs b/Main/System/HeroUI/HeroTrainWin.cs
index 45c67a1..f8c39e8 100644
--- a/Main/System/HeroUI/HeroTrainWin.cs
+++ b/Main/System/HeroUI/HeroTrainWin.cs
@@ -7,7 +7,7 @@
 /// <summary>
 /// 姝﹀皢鍩瑰吇鐣岄潰
 /// </summary>
-public class HeroTrainWin : UIBase
+public partial class HeroTrainWin : UIBase
 {
     [SerializeField] Button showFuncBtn;    //鍙樉绀虹珛缁樻椂鐐瑰嚮锛屾樉绀哄姛鑳�
     [SerializeField] Transform funcForm;
@@ -61,6 +61,9 @@
     [SerializeField] Text allPotentialText; //娼滆兘
     string guid;
     HeroInfo hero;
+
+
+
     protected override void InitComponent()
     {
         showFuncBtn.AddListener(() =>
@@ -132,7 +135,7 @@
         HeroManager.Instance.onHeroChangeEvent -= RefreshHeroEvent;
     }
 
-
+    
     public override void Refresh()
     {
         roleLhModel.Create(hero.SkinID, HeroUIManager.lihuiScale, motionName: "", isLh: true);
@@ -141,6 +144,7 @@
         jobPosNameText.text = HeroUIManager.Instance.GetJobName(hero.heroConfig.Class);
         descText.text = hero.heroConfig.Desc;
         fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculatePower());
+        PlayerMainDate.Instance.AddPowerNotOnTeam(hero);
         lockImg.SetActive(hero.isLock);
         unLockImg.SetActive(!hero.isLock);
         nameText.text = hero.breakLevel == 0 ? hero.heroConfig.Name : Language.Get("herocardbreaklv", hero.heroConfig.Name, hero.breakLevel);
@@ -432,6 +436,7 @@
                 {
                     addPerObject.SetActive(false);
                 });
+                HeroUIManager.Instance.lastFightPower = new KeyValuePair<int, long>(hero.heroId, hero.CalculatePower(false));
             }
 
         }
@@ -475,6 +480,8 @@
         }
 
         allPotentialText.text = allAttrStr.Trim();
-    
+
     }
+
+
 }
\ No newline at end of file
diff --git a/Main/System/HeroUI/HeroUIManager.cs b/Main/System/HeroUI/HeroUIManager.cs
index 8a73894..6772011 100644
--- a/Main/System/HeroUI/HeroUIManager.cs
+++ b/Main/System/HeroUI/HeroUIManager.cs
@@ -18,7 +18,8 @@
 
     public const float lihuiScale = 0.6f;   //绔嬬粯缂╂斁澶у皬
 
-
+    //鐢ㄤ簬闈炰笂闃垫灏嗘垬鍔涘彉鍖栨椂 姝﹀皢ID锛氫笂娆℃垬鍔�
+    public KeyValuePair<int, long> lastFightPower = new KeyValuePair<int, long>(0, 0); 
 
     public override void Init()
     {
@@ -126,7 +127,6 @@
     {
         return hero.heroLevel == GetMaxLVByBreakLV(hero.Quality, hero.breakLevel);
     }
-
 
     #endregion
 
diff --git a/Main/System/Main/FightPowerManager.cs b/Main/System/Main/FightPowerManager.cs
index f1a254d..ed85d77 100644
--- a/Main/System/Main/FightPowerManager.cs
+++ b/Main/System/Main/FightPowerManager.cs
@@ -492,6 +492,36 @@
     #endregion
 
 
+    public Dictionary<int, long> GetHeroTotalAttr(HeroInfo hero)
+    {
+
+        Dictionary<int, long> tmpAttrs = new Dictionary<int, long>();
+        hero.RefreshFetterAttrsWhenCalcPower(TeamType.Story); //缇佺粖灞炴�ц瀹炴椂绠�
+
+#if UNITY_EDITOR
+        propertyStrForDebug = "";
+#endif
+
+        foreach (var config in PlayerPropertyConfig.GetValues())
+        {
+            if (config.showType < 1 || config.showType > 4)
+            {
+                continue;
+            }
+            if (config.showType == 1)
+            {
+                tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, propertyFormula);
+            }
+            else
+            {
+                tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, fightPropertyFormula);
+            }
+        }
+#if UNITY_EDITOR
+        Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�т俊鎭� {propertyStrForDebug}");
+#endif
+        return tmpAttrs;
+    }
 }
 
 
diff --git a/Main/System/Main/PlayerMainDate.cs b/Main/System/Main/PlayerMainDate.cs
index 2711a38..b3d69bf 100644
--- a/Main/System/Main/PlayerMainDate.cs
+++ b/Main/System/Main/PlayerMainDate.cs
@@ -56,27 +56,12 @@
         }
         else
         {
-            if ((long)power > prowNum)
+            if ((long)power != prowNum)
             {
                 prowNumChange = (long)power - prowNum;
                 prowNum = (long)power;
-                isAdd = true;
-                if (customDisplayPower != null && customDisplayPower())
-                {
-                    return;
-                }
-                if (UIManager.Instance.IsOpened<PowerAddWin>())
-                {
-                    AddPowerEvent?.Invoke();
-                    return;
-                }
-                UIManager.Instance.OpenWindow<PowerAddWin>();
-            }
-            else if ((long)power < prowNum)
-            {
-                prowNumChange = prowNum - (long)power;
-                prowNum = (long)power;
-                isAdd = false;
+                isAdd = prowNumChange > 0;
+                prowNumChange = Math.Abs(prowNumChange);
                 if (customDisplayPower != null && customDisplayPower())
                 {
                     return;
@@ -108,7 +93,33 @@
     //     UIManager.Instance.OpenWindow<PowerAddWin>();
     // }
 
-  
+    /// <summary>
+    /// 姝﹀皢鑷韩鐨勬垬鍔涘彉鍖�
+    /// </summary>
+    /// <param name="hero"></param>
+    public void AddPowerNotOnTeam(HeroInfo hero)
+    {
+        if (HeroUIManager.Instance.lastFightPower.Key != hero.heroId)
+        {
+            return;
+        }
+
+        if (hero.IsInTeamByTeamType(TeamType.Story))
+        { 
+            return;
+        }
+
+        prowNumChange = hero.CalculatePower() - HeroUIManager.Instance.lastFightPower.Value;
+        isAdd = prowNumChange > 0;
+        prowNumChange = Math.Abs(prowNumChange);
+        prowNum = hero.CalculatePower();
+        if (UIManager.Instance.IsOpened<PowerAddWin>())
+        {
+            AddPowerEvent?.Invoke();
+            return;
+        }
+        UIManager.Instance.OpenWindow<PowerAddWin>();
+    }
 }
 
 

--
Gitblit v1.8.0