From 09bc892c7283df8757a07b646d5af21ddaa263d1 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期四, 06 十一月 2025 18:22:34 +0800
Subject: [PATCH] 164 天子的考验-客户端

---
 Main/System/Hero/HeroInfo.cs |  207 +++++++++++++++++++++++++++++++++++----------------
 1 files changed, 142 insertions(+), 65 deletions(-)

diff --git a/Main/System/Hero/HeroInfo.cs b/Main/System/Hero/HeroInfo.cs
index bf47961..e0b9657 100644
--- a/Main/System/Hero/HeroInfo.cs
+++ b/Main/System/Hero/HeroInfo.cs
@@ -1,23 +1,16 @@
 using System.Collections.Generic;
 using UnityEngine;
+using LitJson;
 
+//  姝﹀皢淇℃伅锛氬疄闄呰幏寰楃殑姝﹀皢锛屼笉鍖呭惈鍥鹃壌鏁版嵁
 public partial class HeroInfo
 {
-    //  姝﹀皢鏈嶅姟鍣ㄥ敮涓�ID
-    public long sid;
-
     //  姝﹀皢閰嶇疆琛↖D
     public int heroId;
 
-    //  姝﹀皢绛夌骇
-    public int heroLevel;
-
-    //  姝﹀皢鏄熺骇
-    public int heroStar;
-
-    //  姝﹀皢绐佺牬绛夌骇
-    public int breakLevel;
-
+    //  姝﹀皢閰嶇疆
+    public HeroConfig heroConfig { get; private set; }
+    public ItemModel itemHero;  //寮曠敤鑳屽寘閲岀殑 鏁版嵁鍚屾
 
     public HeroCountry heroCountry
     {
@@ -27,6 +20,9 @@
         }
     }
 
+    //  鍝佽川閰嶇疆
+    public HeroQualityConfig qualityConfig { get; private set; }
+
     public int Quality
     {
         get
@@ -35,61 +31,142 @@
         }
     }
 
-
-#region 閰嶇疆
-    //  姝﹀皢閰嶇疆
-    public HeroConfig heroConfig;
-
-    //  瑙夐啋閰嶇疆
-    public HeroAwakeConfig awakeConfig;
-
-    //  绐佺牬閰嶇疆
-    public HeroBreakConfig breakConfig;
-
-    //  缇佺粖閰嶇疆
-    public HeroFetterConfig fetterConfig;
-
-    //  鍝佽川瑙夐啋閰嶇疆
-    public HeroQualityAwakeConfig qualityAwakeConfig;
-
-    //  鍝佽川閰嶇疆
-    public HeroQualityConfig qualityConfig;
-
-    //  鍝佽川绐佺牬閰嶇疆
-    public HeroQualityBreakConfig qualityBreakConfig;
-
-    //  澶╄祴閰嶇疆
-    public HeroTalentConfig talentConfig;
-#endregion 閰嶇疆
-
-
-    public HeroSkillMgr heroSkillMgr;
-
-    public HeroInfo(CB122_tagSCHeroInfo.tagSCHero scHeroInfo, ItemModel itemHero)
+    //  姝﹀皢绛夌骇
+    public int heroLevel
     {
-        heroSkillMgr = new HeroSkillMgr(this);
-        // HeroConfigUtility
-// 71 # 鑻遍泟澶╄祴ID鍒楄〃
-// 73 # 鑻遍泟澶╄祴ID绛夌骇鍒楄〃锛屽搴�71澶╄祴ID鐨勭瓑绾�
-// 75 # 鑻遍泟澶╄祴娲楃偧閿佸畾绱㈠紩鍒楄〃锛屽搴�71澶╄祴ID绱㈠紩
-// 77 # 鑻遍泟澶╄祴娲楃偧闅忔満ID鍒楄〃
-// 79 # 鑻遍泟瑙夐啋鏃堕殢鏈哄ぉ璧嬮�夐」ID鍒楄〃
-// 70 # 鑻遍泟绛夌骇
-// 72 # 鑻遍泟鏄熺骇
-// 74 # 鑻遍泟绐佺牬绛夌骇
-// 76 # 鑻遍泟瑙夐啋绛夌骇
-// 78 # 鑻遍泟浣跨敤鐨勭毊鑲ょ储寮�
-// 80 # 涓婚樀鍨嬩笂闃典綅缃�
-
-        #region 鐨偆
-        // skinConfig
-        #endregion 鐨偆
-
-
-        #region 澶╄祴
-
-        #endregion 澶╄祴
+        get
+        {
+            if (itemHero == null)
+                return 0;
+            return itemHero.GetUseDataFirstValue(70);
+        }
     }
 
 
+    public bool isLock
+    {
+        get
+        {
+            return itemHero.itemInfo.isLock;
+        }
+    }
+
+
+    //宸插涔犵殑鎵�鏈夋妧鑳藉彇鏈�楂樼骇鐨勬妧鑳�
+    Dictionary<int, int> allSkillTypeIDToID = new Dictionary<int, int>();  //鎶�鑳界被鍨婭D锛�  鏈�楂樻妧鑳絀D
+
+
+    public HeroInfo(ItemModel _itemHero)
+    {
+        UpdateHero(_itemHero);
+    }
+
+
+
+
+    public void UpdateHero(ItemModel _itemHero)
+    {
+        itemHero = _itemHero;
+        // HeroConfigUtility
+        heroId = itemHero.config.ID;
+
+        InitConfigs();
+
+        CalculateProperties();
+        // //  缇佺粖
+        // fetterInfoList.Clear();
+        // for (int i = 0; i < heroConfig.FetterIDList.Length; i++)
+        // {
+        //     fetterInfoList.Add(new HeroFetterInfo(this, heroConfig.FetterIDList[i]));
+        // }
+
+        // 80 # 涓婚樀鍨嬩笂闃典綅缃�
+    }
+
+    protected void InitConfigs()
+    {
+        //  姝﹀皢閰嶇疆
+        heroConfig = HeroConfig.Get(heroId);
+        //  鍝佽川閰嶇疆
+        qualityConfig = HeroQualityConfig.Get(Quality);
+
+        //  鍝佽川绐佺牬閰嶇疆
+        qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, breakLevel);
+
+        breakConfig = HeroBreakConfig.GetHeroBreakConfig(heroId, breakLevel);
+        awakeConfig = HeroAwakeConfig.GetHeroAwakeConfig(heroId, awakeLevel);
+        qualityAwakeConfig = HeroQualityAwakeConfig.GetQualityAwakeConfig(Quality, awakeLevel);
+
+    }
+
+
+
+    //鏄惁涓妜闃� 鏈嶅姟绔槦浼�
+    public bool IsInTeamByTeamType(TeamType teamType)
+    {
+        return TeamManager.Instance.GetTeam(teamType).HasHeroInServer(itemHero.guid);
+    }
+
+    //鏄惁涓婁换浣曢樀瀹�
+    public bool IsInAnyTeam()
+    {
+        for (int i = 1; i < (int)TeamType.Max; i++)
+        {
+            if (TeamManager.Instance.GetTeam((TeamType)i).HasHeroInServer(itemHero.guid))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    //鏄惁涓婁换浣曢樀瀹癸紝涓斿彧鏈変竴鍙�
+    public bool IsInAnyTeamJustOne()
+    {
+        for (int i = 1; i < (int)TeamType.Max; i++)
+        {
+            var team = TeamManager.Instance.GetTeam((TeamType)i);
+            if (team.HasHeroInServer(itemHero.guid))
+            {
+                if (team.GetTeamHeroCount() == 1)
+                    return true;
+            }
+        }
+        return false;
+    }
+
+    //涓嬮樀鎵�鏈夐樀瀹�
+    public void LeaveAllTeam()
+    {
+        for (int i = 1; i < (int)TeamType.Max; i++)
+        {
+            int pos;
+            var team = TeamManager.Instance.GetTeam((TeamType)i);
+            if (TeamManager.Instance.GetTeam((TeamType)i).RemoveHero(this, out pos))
+            {
+                //濡傛灉鏄渶鍚庝竴涓灏嗭紝鍒欓粯璁や笂闃典竴涓�
+                team.SaveTeam();
+            }
+        }
+    }
+
+    public long GetSkillsFightPower()
+    {
+        long fightPower = 0;
+        foreach (var skillID in allSkillTypeIDToID.Values)
+        {
+            fightPower += SkillConfig.Get(skillID).FightPower;
+        }
+        return fightPower;
+    }
+    
+
+    public void ChangeLockState()
+    {
+        var pack = new CB238_tagCSHeroLock();
+        pack.ItemIndex = (ushort)itemHero.gridIndex;
+        pack.IsLock = isLock ? (byte)0 : (byte)1;
+        GameNetSystem.Instance.SendInfo(pack);
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.8.0