From 93cab33f292e99c81e738b2b6c58c7fa21a7f371 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 03 十二月 2025 17:42:37 +0800
Subject: [PATCH] 125 战斗 预加载资源Action

---
 Main/System/Battle/BattleObject/BattleObjectFactory.cs |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/Main/System/Battle/BattleObject/BattleObjectFactory.cs b/Main/System/Battle/BattleObject/BattleObjectFactory.cs
index 82bbde4..58cae7d 100644
--- a/Main/System/Battle/BattleObject/BattleObjectFactory.cs
+++ b/Main/System/Battle/BattleObject/BattleObjectFactory.cs
@@ -24,12 +24,26 @@
     //  杩欓噷鎶ラ敊浜嗘鏌ヤ竴涓�
     public static BattleObject CreateBattleObject(BattleField _battleField, List<GameObject> posNodeList, TeamHero teamHero, BattleCamp _Camp)
     {
-        HeroSkinConfig skinCfg = teamHero.skinConfig;
+        var skinCfg = HeroSkinConfig.Get(teamHero.SkinID);
         if (skinCfg == null)
         {
-            Debug.LogError(teamHero.heroId + "BattleObjectFactory.CreateBattleObject: skinCfg is null for " + teamHero.SkinID);
+            Debug.LogError($"BattleObjectFactory: skinCfg is null for SkinID {teamHero.SkinID}");
             return null;
         }
+
+        // ===== 绠�鍖栵細鐩存帴浠庣紦瀛樿幏鍙栵紝缂撳瓨鍐呴儴浼氳嚜鍔ㄥ姞杞� =====
+        SkeletonDataAsset skeletonDataAsset = BattleResManager.Instance.GetSpineResource(
+            "Hero/SpineRes/", 
+            skinCfg.SpineRes, 
+            _battleField.guid
+        );
+        
+        if (skeletonDataAsset == null)
+        {
+            Debug.LogError($"BattleObjectFactory: Failed to load SkeletonDataAsset for {skinCfg.SpineRes}");
+            return null;
+        }
+        // ==============================================
 
         GameObject battleGO = ResManager.Instance.LoadAsset<GameObject>("Hero/SpineRes", "Hero_001"/*skinCfg.SpineRes*/);
 
@@ -40,12 +54,6 @@
         GameObject realGO = GameObject.Instantiate(battleGO, goParent.transform);
         SkeletonAnimation skeletonAnimation = realGO.GetComponentInChildren<SkeletonAnimation>(true);
 
-        var skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("Hero/SpineRes/", skinCfg.SpineRes);
-        if (skeletonDataAsset == null)
-        {
-            Debug.LogError("BattleObjectFactory.CreateBattleObject: skeletonDataAsset is null for " + skinCfg.SpineRes);
-            return null;
-        }
 
         float finalScaleRate = modelScaleRate * teamHero.modelScale;
 

--
Gitblit v1.8.0