From bc1cb6da854cb2e9144f10ed55330a537ecdca16 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 04 三月 2026 14:35:57 +0800
Subject: [PATCH] 466 h5版本 资源规则修改 打包修改(未完成 勿拉取)

---
 Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs |   46 +++++++++++++++++++---------------------------
 1 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs b/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs
index 5168d96..446b672 100644
--- a/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs
+++ b/Main/System/HeroUI/HeroHeadBaseNoTrainCell.cs
@@ -89,20 +89,22 @@
 
     void Awake()
     {
-        LoadPrefab();
+        LoadPrefab().Forget();
     }
 
     // 姝﹀皢灏忓ご鍍忥紝锛堣亴涓氬拰鍚嶇О涓嶅啀姝ょ鐞嗭紝鍚勪釜鐣岄潰鎺掔増涓嶅悓锛�
-    public void Init(int heroID, bool _gray = false, UnityAction onclick = null)
+    public async UniTask Init(int heroID, bool _gray = false, UnityAction onclick = null)
     {
-        LoadPrefab();   //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+        await LoadPrefab();
         clickBtn.AddListener(onclick);
         var heroConfig = HeroConfig.Get(heroID);
         qualityBG.SetSprite("heroheadBG" + heroConfig.Quality);
 
-        var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(heroConfig.SkinIDList[0]).SquareIcon);
-        heroIcon.overrideSprite = sprite;
-        heroIcon.gray = _gray;
+        UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(heroConfig.SkinIDList[0]).SquareIcon, heroIcon).ContinueWith(() =>
+        {
+            heroIcon.gray = _gray;
+        }).Forget();
+        
         qualityBG.gray = _gray;
 
         countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
@@ -112,28 +114,9 @@
 
     }
 
-    public async UniTask InitAsync(int heroID, bool _gray = false, UnityAction onclick = null)
-    {
-        LoadPrefab();   //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
-        clickBtn.AddListener(onclick);
-        var heroConfig = HeroConfig.Get(heroID);
-        qualityBG.SetSprite("heroheadBG" + heroConfig.Quality);
-
-        var sprite = await UILoader.LoadSpriteAsync("HeroHead", HeroSkinConfig.Get(heroConfig.SkinIDList[0]).SquareIcon);
-        if (this == null) return;
-        heroIcon.overrideSprite = sprite;
-        heroIcon.gray = _gray;
-        qualityBG.gray = _gray;
-
-        countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
-        jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class));
-        nameText.text = heroConfig.Name;
-
-
-    }
 
     GameObject cellContainer;
-    protected void LoadPrefab()
+    protected async UniTask LoadPrefab()
     {
         if (cellContainer != null)
             return;
@@ -146,7 +129,16 @@
         }
         if (cellContainer == null)
         {
-            cellContainer = UIUtility.CreateWidget("HeroHeadBaseNoTrainCell", "Container_HeadCell");
+            cellContainer = await UIUtility.CreateWidget("HeroHeadBaseNoTrainCell", "Container_HeadCell");
+
+            if (this == null)
+            {
+                if (cellContainer != null)
+                {
+                    DestroyImmediate(cellContainer);
+                }
+                return;
+            }
 
             if (cellContainer != null)
             {

--
Gitblit v1.8.0