From ed98029a88cd89702980ac7c40b711afddc5aeb2 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 20 十一月 2025 14:44:59 +0800
Subject: [PATCH] Merge branch 'master' of http://mobile.secondworld.net.cn:10010/r/Project_SG_scripts

---
 Main/System/Battle/BattleObject/BattleObjectFactory.cs |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/Main/System/Battle/BattleObject/BattleObjectFactory.cs b/Main/System/Battle/BattleObject/BattleObjectFactory.cs
index e9668f3..82bbde4 100644
--- a/Main/System/Battle/BattleObject/BattleObjectFactory.cs
+++ b/Main/System/Battle/BattleObject/BattleObjectFactory.cs
@@ -1,4 +1,3 @@
-
 using System.Collections.Generic;
 using System;
 using UnityEngine;
@@ -11,7 +10,7 @@
 
     private static float m_modelScaleRate = 0f;
 
-    private static float modelScaleRate
+    public static float modelScaleRate
     {
         get
         {
@@ -34,8 +33,6 @@
 
         GameObject battleGO = ResManager.Instance.LoadAsset<GameObject>("Hero/SpineRes", "Hero_001"/*skinCfg.SpineRes*/);
 
-
-
         GameObject goParent = posNodeList[teamHero.positionNum];
         BattleObject battleObject = new BattleObject(_battleField);
         battleObject.ObjID = teamHero.ObjID;
@@ -50,17 +47,35 @@
             return null;
         }
 
-
         float finalScaleRate = modelScaleRate * teamHero.modelScale;
 
+        skeletonAnimation.initialSkinName = skinCfg.InitialSkinName;
         skeletonAnimation.skeletonDataAsset = skeletonDataAsset;
         skeletonAnimation.Initialize(true);
+
+        // 鍒濆鍖栧畬鎴愬悗璁剧疆鐨偆
+        if (!string.IsNullOrEmpty(skinCfg.InitialSkinName))
+        {
+            var skeleton = skeletonAnimation.Skeleton;
+            skeleton.SetSkin(skinCfg.InitialSkinName);
+            skeleton.SetSlotsToSetupPose();
+            skeletonAnimation.Update(0);
+        }
+
         realGO.name = battleObject.ObjID.ToString();
         realGO.transform.localScale = new Vector3(finalScaleRate, finalScaleRate, finalScaleRate);
         RectTransform rectTrans = realGO.GetComponent<RectTransform>();
         rectTrans.anchoredPosition = Vector2.zero;
         battleObject.Init(realGO, teamHero, _Camp);
 
+#if UNITY_EDITOR
+        BattleDebug.LogError(
+            "鍒濆鍖� 鏈鍔�" +
+            (battleObject.Camp == BattleCamp.Red ? "銆愮孩鏂广��" : "銆愯摑鏂广�� ") +
+            $"姝﹀皢: {battleObject.teamHero.name}\n" +
+            $"褰撳墠琛�閲�: {battleObject.teamHero.curHp} -> 鏈�澶ц閲弡battleObject.teamHero.maxHp}\n"
+        );
+#endif
 
         return battleObject;
     }

--
Gitblit v1.8.0