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/GiftBaseCell.cs | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/Main/System/HeroUI/GiftBaseCell.cs b/Main/System/HeroUI/GiftBaseCell.cs
index cf7b6cc..4113405 100644
--- a/Main/System/HeroUI/GiftBaseCell.cs
+++ b/Main/System/HeroUI/GiftBaseCell.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
+using Cysharp.Threading.Tasks;
public class GiftBaseCell : MonoBehaviour
{
@@ -114,14 +115,15 @@
void Awake()
{
- LoadPrefab();
+ LoadPrefab().Forget();
}
//showState 0锛氫笉鏄剧ず 1锛氭柊澧� 2锛氭彁鍗�
//giftID 0 :浠h〃鐏拌壊闇�鍗囨槦婵�娲� -1锛氫唬琛ㄦ鑹查渶瑙夐啋婵�娲伙紝鍏朵粬鏍规嵁閰嶈〃锛屾病鏈夊ぉ璧嬬殑澶栧眰鎺у埗鏄鹃殣
- public void Init(int giftID, int lv, int showState = 0, int heroID = 0, int index = 0, int awakeLevel = 0)
+ public async UniTask Init(int giftID, int lv, int showState = 0, int heroID = 0, int index = 0, int awakeLevel = 0)
{
- LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
if (HeroTalentConfig.HasKey(giftID))
{
var config = HeroTalentConfig.Get(giftID);
@@ -175,18 +177,18 @@
}
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
}
else if (giftID == 0)
{
SmallTipWin.showText = Language.Get("HeroGift1");
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
}
else if (giftID == -1)
{
SmallTipWin.showText = Language.Get("HeroGift2", HeroAwakeConfig.GetAwakeLVByUnLockGiftIndex(heroID, index));
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
}
}
@@ -242,7 +244,7 @@
}
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -255,7 +257,20 @@
}
if (cellContainer == null)
{
- cellContainer = UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+ var inst = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+
+ if (this == null)
+ {
+ if (null != inst) GameObject.DestroyImmediate(inst);
+ return;
+ }
+
+ if (cellContainer != null)
+ {
+ GameObject.DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
if (cellContainer != null)
{
--
Gitblit v1.8.0