From 39001a600fcae2bcf27c225df8752d75fb92fef4 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 31 十月 2025 11:18:26 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/System/Team/TeamHero.cs |  144 +++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 136 insertions(+), 8 deletions(-)

diff --git a/Main/System/Team/TeamHero.cs b/Main/System/Team/TeamHero.cs
index e545671..30065a2 100644
--- a/Main/System/Team/TeamHero.cs
+++ b/Main/System/Team/TeamHero.cs
@@ -1,15 +1,143 @@
-
+using UnityEngine;
 
 public partial class TeamHero
 {
-    public HeroInfo heroInfo;
-    public TeamBase teamBase;
-    public int heroIndex;
+    public int heroId;
+
+    public HeroCountry Country;
+    public int SkinID;
+    public HeroSkinConfig skinConfig;
+    public string guid;
+
+    public float modelScale = 1f;
+
+    public int level = 0;
+
+    public string name;
+
+    public TeamBase teamBase
+    {
+        get; private set;
+    }
+    public int positionNum; //娉ㄦ剰鏈嶅姟绔殑1鍙蜂綅鏄�1锛屽鎴风鍦ㄤ娇鐢ㄦ椂鏄�0锛岄�氫俊鍜岀瓥鍒掓矡閫氱敤1
+
+
+    //  鎴樺満鏁版嵁
+    public int ObjID = 0;// 鎴樻枟鍗曚綅鍞竴ID
+
+    public int NPCID = 0;// 鎴樻枟NPCID锛屼笉鍚岀殑瀹炰緥ID瀵瑰簲鐨凬PCID鍙兘涓�鏍� (鐩墠鍙敤鏉ュ尯鍒帺瀹惰窡NPC)
+
+
+    //  鏈嶅姟鍣ㄦ潵鐨勬瀯閫�
+    public TeamHero(HB424_tagSCTurnFightInit.tagSCTurnFightObj fightObj, TeamBase _teamBase)
+    {
+        //  鍒ゆ柇涓�涓嬫槸npc杩樻槸鐜╁
+        heroId = (int)fightObj.HeroID;
+
+        // B4 24 鍥炲悎鎴樻枟鍒濆鍖� #tagSCTurnFightInit 
+        // 灏佸寘涓殑 HeroID銆丼kinID 瀛楁涓嶅啀鏄帺瀹堕樀瀹圭嫭鏈夛紝NPC闃靛涔熷彲鑳芥湁鍊硷紝涓�鑸槸鍏宠仈姝﹀皢鐨凬PC鏈夊��
+        // 濡傛灉 HeroID銆丼kinID 涓嶄负绌猴紝鍒欏彲璁や负鏄叧鑱旀灏嗙殑NPC锛屽瑙傜浉鍏抽粯璁ら�氳繃HeroID璇诲彇姝﹀皢鐩稿叧锛屽鍚嶇О
+        // 鐨偆 SkinID 涓嶄负绌烘椂锛屽垯妯″瀷榛樿浣跨敤璇ョ毊鑲�
+        // 濡傛灉 HeroID銆丼kinID 涓虹┖锛� NPCID涓嶄负绌猴紝鍒欒蛋鍘烴PC榛樿瑙勫垯
+
+        //  琛ュ厖 skinid璺焗eroid瑕佷箞鍚屾椂娌℃湁 瑕佷箞鍚屾椂鏈� 濡傛灉杩欎笁涓猧d閮芥病鏈夌殑璇� 閭e氨鏄厤缃弗閲嶉敊璇� 鏃犳硶寮ヨˉ
+
+        if (fightObj.SkinID > 0 && fightObj.HeroID > 0)
+        {
+            // 璧扮帺瀹堕�昏緫
+            var heroConfig = HeroConfig.Get(heroId);
+            if (null == heroConfig)
+            {
+                Debug.LogError("hero config is null, heroId : " + heroId);
+                return;
+            }
+            Country = (HeroCountry)heroConfig.Country;
+            SkinID = (int)fightObj.SkinID;
+            modelScale = 1f;
+            name = heroConfig.Name;
+
+        }
+        else
+        {
+            throw new System.Exception("hero id and skin id are both invalid, npc id is invalid too (all <= 0)");
+        }
+
+        if (fightObj.NPCID > 0)
+        {
+            NPCConfig npcConfig = NPCConfig.Get((int)fightObj.NPCID);
+            if (null != npcConfig)
+            {
+                modelScale = npcConfig.ModelScale;
+            }
+        }
+
+        level = (int)fightObj.LV;
+
+        skinConfig = HeroSkinConfig.Get(SkinID);
+        teamBase = _teamBase;
+
+        ObjID = (int)fightObj.ObjID;
+        NPCID = (int)fightObj.NPCID;
+
+        // HPEx * 1浜� + HP
+
+        curHp = (long)fightObj.HPEx * (long)Constants.ExpPointValue + (long)fightObj.HP;
+        maxHp = (long)fightObj.MaxHPEx * (long)Constants.ExpPointValue + (long)fightObj.MaxHP;
+        rage = (int)fightObj.AngreXP;
+
+        positionNum = fightObj.PosNum - 1;
+
+        //  銆愰噸瑕併�戞垬鏂楁瀯鎴愰噷娌℃湁鍗$墝鐨刧uid
+        guid = string.Empty;
+
+        Update();
+    }
+
+    private static int DecreasingObjID = 0;
+
+    //  甯冮樀鏃剁殑鏋勯��
+    public TeamHero(HeroInfo heroInfo, int posNum, TeamBase _teamBase)
+    {
+        heroId = heroInfo.itemHero.config.ID;
+        SkinID = heroInfo.SkinID;
+        skinConfig = heroInfo.skinConfig;
+        Country = heroInfo.heroCountry;
+
+        teamBase = _teamBase;
+
+        ObjID = --DecreasingObjID;
+        NPCID = 0;
+
+        curHp = heroInfo.hp;
+        maxHp = heroInfo.hp;
+        rage = 0;
+
+        positionNum = posNum;
+
+        //  銆愰噸瑕併�戝竷闃甸噷鐨勮guid
+        guid = heroInfo.itemHero.guid;
+
+        Update();
+    }
+
+    public void OnSwapPosition(TeamHero teamHero)
+    {
+        teamBase.SwapPosition(positionNum, teamHero.positionNum);
+
+        Update();
+    }
+
+    public void Update()
+    {
+
+    }
+
 
     //  鏈�缁堝睘鎬� 褰撳墠灞炴�у簲璇ユ槸瑕佸湪杩欎竴灞傜殑
 
-	public int GetPower()
-	{
-		return heroInfo.CalculatePower();
-	}    
+    public int GetPower()
+    {
+        // 璁$畻鎴樻枟鍔沋YL TODO
+        return 0;
+    }    
 }
\ No newline at end of file

--
Gitblit v1.8.0