From 51b0f6ed9f4e1d3bb6f8144470b46908c7699a96 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 11 五月 2026 16:20:37 +0800
Subject: [PATCH] Merge branch 'master' into h5version

---
 Main/System/HeroUI/HeroCollectionCardCell.cs |   46 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/Main/System/HeroUI/HeroCollectionCardCell.cs b/Main/System/HeroUI/HeroCollectionCardCell.cs
index 01476c2..084f1aa 100644
--- a/Main/System/HeroUI/HeroCollectionCardCell.cs
+++ b/Main/System/HeroUI/HeroCollectionCardCell.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
 using UnityEngine;
 using UnityEngine.UI;
 using System.Collections.Generic;
@@ -17,8 +18,14 @@
     [SerializeField] GameObject unGetObj;
     [SerializeField] GameObject activeObj; // 鍙縺娲诲甫娴佸厜鏁堟灉鏉愯川
     [SerializeField] GameObject actLimitObj; // 娲诲姩闄愬畾
+
+    private int displayVersion;
+
     public void Display(int index, int quality)
     {
+        displayVersion++;
+        int version = displayVersion;
+
         var heroID = HeroUIManager.Instance.heroCollectDict[quality][index];
         var heroConfig = HeroConfig.Get(heroID);
 
@@ -26,7 +33,8 @@
 
         HB122_tagSCHeroInfo.tagSCHero colData;
         HeroUIManager.Instance.TryGetHeroBookInfo(heroID, out colData);
-        heroCardBG.SetSprite("herocardbg" + heroConfig.Quality);
+
+        LoadImageAsync(heroCardBG, "herocardbg" + heroConfig.Quality, version).Forget();
 
         //鍒嗕负0鏈幏寰椼��1鍙縺娲汇��2甯歌銆�3绐佺牬鍗囩骇銆�4銆佹槦鍗囩骇銆�5宸叉弧绾�
         int funcState = HeroUIManager.Instance.GetHeroBookState(heroID, quality);
@@ -36,16 +44,17 @@
         unGetObj.SetActive(funcState == 0);
         actLimitObj.SetActive(heroConfig.IsActLimit == 1);
 
-        countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
-        jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class));
-        heroModel.Create(heroConfig.SkinIDList[0], heroConfig.UIScale);
+        LoadImageAsync(countryImg, HeroUIManager.Instance.GetCountryIconName(heroConfig.Country), version).Forget();
+        LoadImageAsync(jobImg, HeroUIManager.Instance.GetJobIconName(heroConfig.Class), version).Forget();
+
+        DelayedCreateSpine(heroConfig.SkinIDList[0], heroConfig.UIScale, version).Forget();
 
         redpoint.redpointId = MainRedDot.HeroCardCollectRedpoint * 10000000 + heroID;
 
         if (funcState == 3 || funcState == 4)
         {
             trainStateImg.SetActive(true);
-            trainStateImg.SetSprite("herofuncstate4");
+            LoadImageAsync(trainStateImg, "herofuncstate4", version).Forget();
         }
         else
         {
@@ -64,20 +73,31 @@
             var state = HeroUIManager.Instance.GetHeroBookState(heroID, quality);
             if (state == 1 || state == 3 || state == 4)
             {
-                UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>();
+                UIManager.Instance.OpenWindowAsync<HeroCollectionLvUpWin>().Forget();
             }
             else
             {
                 HeroUIManager.Instance.selectForPreviewHeroID = heroID;
-                UIManager.Instance.OpenWindow<HeroBestWin>();
+                UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget();
             }
         });
-        
-        // bookLVBtn.AddListener(() =>
-        // {
-        //     HeroUIManager.Instance.selectCollectHeroID = heroID;
-        //     UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>();
-        // });
+    }
+
+    private async UniTaskVoid LoadImageAsync(Image image, string iconKey, int version)
+    {
+        var sprite = await UILoader.LoadSpriteAsync(iconKey);
+        if (displayVersion != version) return;
+        if (image != null && sprite != null)
+            image.overrideSprite = sprite;
+    }
+
+    private async UniTaskVoid DelayedCreateSpine(int skinID, float scale, int version)
+    {
+        await UniTask.NextFrame();
+        await UniTask.NextFrame();
+        if (displayVersion != version) return;
+        heroModel.Create(skinID, scale).Forget();
     }
 }
 
+ 
\ No newline at end of file

--
Gitblit v1.8.0