From 0fa617a09eedf6bdb25eda55fac1d3344859fd93 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 31 三月 2026 19:46:31 +0800
Subject: [PATCH] webgl
---
Main/System/HeroUI/HeroCollectionCardCell.cs | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/Main/System/HeroUI/HeroCollectionCardCell.cs b/Main/System/HeroUI/HeroCollectionCardCell.cs
index 5ea7b56..9466d7f 100644
--- a/Main/System/HeroUI/HeroCollectionCardCell.cs
+++ b/Main/System/HeroUI/HeroCollectionCardCell.cs
@@ -1,6 +1,8 @@
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
+using System.Threading;
public class HeroCollectionCardCell : MonoBehaviour
{
@@ -17,6 +19,8 @@
[SerializeField] GameObject unGetObj;
[SerializeField] GameObject activeObj; // 鍙縺娲诲甫娴佸厜鏁堟灉鏉愯川
[SerializeField] GameObject actLimitObj; // 娲诲姩闄愬畾
+
+ private CancellationTokenSource displayCts;
public void Display(int index, int quality)
{
var heroID = HeroUIManager.Instance.heroCollectDict[quality][index];
@@ -38,7 +42,12 @@
countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class));
- heroModel.Create(heroConfig.SkinIDList[0], heroConfig.UIScale);
+
+ // 鍘绘姈鍔犺浇锛氬揩閫熸粴鍔ㄦ椂寤惰繜2甯у啀鍒涘缓Spine锛屽鏋滃崱鐗囧湪寤惰繜鍐呰澶嶇敤鍒欏彇娑堟棫鍔犺浇
+ displayCts?.Cancel();
+ displayCts?.Dispose();
+ displayCts = new CancellationTokenSource();
+ DelayedCreateSpine(heroConfig.SkinIDList[0], heroConfig.UIScale, displayCts.Token).Forget();
redpoint.redpointId = MainRedDot.HeroCardCollectRedpoint * 10000000 + heroID;
@@ -64,12 +73,12 @@
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<HeroBestBaseWin>();
+ UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget();
}
});
@@ -79,5 +88,19 @@
// UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>();
// });
}
+
+ private async UniTaskVoid DelayedCreateSpine(int skinID, float scale, CancellationToken ct)
+ {
+ // 寤惰繜2甯э紝蹇�熸粴鍔ㄦ椂鍗$墖浼氳澶嶇敤锛孋TS鍙栨秷鍚庝笉浼氱户缁垱寤篠pine
+ await UniTask.NextFrame(ct);
+ await UniTask.NextFrame(ct);
+ heroModel.Create(skinID, scale).Forget();
+ }
+
+ void OnDestroy()
+ {
+ displayCts?.Cancel();
+ displayCts?.Dispose();
+ }
}
--
Gitblit v1.8.0