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/SkillUI/SkillBaseCell.cs | 56 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/Main/System/SkillUI/SkillBaseCell.cs b/Main/System/SkillUI/SkillBaseCell.cs
index 06ccab1..4a73513 100644
--- a/Main/System/SkillUI/SkillBaseCell.cs
+++ b/Main/System/SkillUI/SkillBaseCell.cs
@@ -1,6 +1,7 @@
锘縰sing UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
+using Cysharp.Threading.Tasks;
public class SkillBaseCell : MonoBehaviour
{
@@ -45,13 +46,29 @@
}
}
- void Awake()
+ Image m_WordBG;
+ Image wordBG
{
- LoadPrefab();
+ get
+ {
+ if (m_WordBG == null)
+ {
+ m_WordBG = this.transform.GetComponent<Image>("Container_SkillCell/Image");
+ }
+ return m_WordBG;
+ }
}
- public void Init(int skillID, UnityAction onclick = null, bool showType = false)
+
+ void Awake()
{
+ LoadPrefab().Forget();
+ }
+
+ public async UniTask Init(int skillID, UnityAction onclick = null, bool showType = false)
+ {
+ await LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+ if (this == null) return;
var config = SkillConfig.Get(skillID);
if (config == null)
{
@@ -75,15 +92,17 @@
if (showType)
{
skillType.text = Language.Get(config.FuncType == 1 ? "HeroSkillType_1" : "HeroSkillType_2");
+ wordBG.SetActive(true);
}
else
- {
+ {
skillType.text = string.Empty;
+ wordBG.SetActive(false);
}
}
GameObject cellContainer;
- protected void LoadPrefab()
+ protected async UniTask LoadPrefab()
{
if (cellContainer != null)
return;
@@ -94,15 +113,26 @@
cellContainer = tmp.gameObject;
return;
}
- if (cellContainer == null)
- {
- cellContainer = UIUtility.CreateWidget("SkillBaseCell", "Container_SkillCell");
- if (cellContainer != null)
- {
- cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
- cellContainer.transform.SetAsFirstSibling();
- }
+ var inst = await UIUtility.CreateWidget("SkillBaseCell", "Container_SkillCell");
+
+ if (this == null)
+ {
+ if (null != inst) DestroyImmediate(inst);
+ return;
+ }
+
+ if (cellContainer != null)
+ {
+ DestroyImmediate(inst);
+ return;
+ }
+ cellContainer = inst;
+
+ if (cellContainer != null)
+ {
+ cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
+ cellContainer.transform.SetAsFirstSibling();
}
//缂╂斁鍒板拰鐖秗ect涓�鏍峰ぇ
--
Gitblit v1.8.0