From 3b2a6bb9047cfce9f501593b3669a9c1af6c5df4 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 05 十一月 2025 17:40:23 +0800
Subject: [PATCH] 130 战斗修改回合样式

---
 Main/System/Hero/HeroManager.cs |   60 +++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 39 insertions(+), 21 deletions(-)

diff --git a/Main/System/Hero/HeroManager.cs b/Main/System/Hero/HeroManager.cs
index af90076..49ef7bd 100644
--- a/Main/System/Hero/HeroManager.cs
+++ b/Main/System/Hero/HeroManager.cs
@@ -10,16 +10,9 @@
     //鍒濆鍒涘缓锛�0725锛夛紝鍚庣画璺熼殢鑳屽寘浜嬩欢澧炲姞鍒犻櫎  key = guid
     protected Dictionary<string, HeroInfo> heroInfoDict = new Dictionary<string, HeroInfo>();
 
-
-
-    //姝﹀皢绾㈢偣
-    //MainRedDot.HeroCardRedpoint * 1000 + hero.itemHero.gridIndex;
-
-    public Action<HeroInfo> onNewHeroEvent;
-
     public Action<HeroInfo> onHeroChangeEvent;
 
-    public Action<HeroInfo> onHeroDeleteEvent;
+    public Action<int> onHeroDeleteEvent;
 
     public override void Init()
     {
@@ -40,7 +33,7 @@
 
     void OnBeforePlayerDataInitialize()
     {
-        
+
         heroInfoDict.Clear();
     }
 
@@ -65,7 +58,7 @@
         }
     }
 
-    void DeleteHero(PackType packType, string guid)
+    void DeleteHero(PackType packType, string guid, int itemID, int index, int clearType)
     {
         if (packType == PackType.Hero)
         {
@@ -73,9 +66,8 @@
             heroInfoDict.TryGetValue(guid, out heroInfo);
 
             heroInfoDict.Remove(guid);
-            
-            if (null != heroInfo)
-                onHeroDeleteEvent?.Invoke(heroInfo);
+
+            onHeroDeleteEvent?.Invoke(itemID);
         }
     }
 
@@ -95,12 +87,27 @@
     {
         if (job == 0 && country == 0)
             return heroInfoDict.Keys.ToList();
-            
-        return heroInfoDict.Keys.Where((x) =>
+
+
+        List<string> retGuidList = new List<string>();
+        foreach (string guid in heroInfoDict.Keys)
         {
-            HeroInfo heroInfo = heroInfoDict[x];
-            return heroInfo.heroConfig.Class == job && heroInfo.heroConfig.Country == country;
-        }).ToList();
+            HeroInfo heroInfo = heroInfoDict[guid];
+            //0浠h〃鍏ㄩ儴
+            if (job == 0 || country == 0)
+            {
+                if (job != 0 && job == heroInfo.heroConfig.Class)
+                    retGuidList.Add(guid);
+                if (country != 0 && country == heroInfo.heroConfig.Country)
+                    retGuidList.Add(guid);
+            }
+            else
+            {
+                if (job == heroInfo.heroConfig.Class && country == heroInfo.heroConfig.Country)
+                    retGuidList.Add(guid);
+            }
+        }
+        return retGuidList;
     }
 
     public List<HeroInfo> GetPowerfulHeroList()
@@ -109,8 +116,8 @@
 
         heroList.Sort((a, b) =>
         {
-            int power1 = a.CalculatePower();
-            int power2 = b.CalculatePower();
+            long power1 = a.CalculateFightPower(false);
+            long power2 = b.CalculateFightPower(false);
 
             if (power1 == power2)
             {
@@ -131,7 +138,18 @@
     }
 
 
+    public int GetHeroCount()
+    {
+        return heroInfoDict.Count;
+    }
 
+    public bool HasHero(int heroID)
+    {
+        return PackManager.Instance.GetSinglePack(PackType.Hero).HasItem(heroID);
+    }
 
-
+    public int GetHeroCountByID(int heroID)
+    {
+        return (int)PackManager.Instance.GetSinglePack(PackType.Hero).GetCountById(heroID);
+    }
 }
\ No newline at end of file

--
Gitblit v1.8.0