| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using UnityEngine.Events; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class SkillWordCell : MonoBehaviour |
| | | { |
| | |
| | | |
| | | void Awake() |
| | | { |
| | | LoadPrefab(); |
| | | LoadPrefab().Forget(); |
| | | } |
| | | |
| | | public void Init(int skillID, UnityAction onclick = null, bool showType = false) |
| | | public async UniTask Init(int skillID, UnityAction onclick = null, bool showType = false) |
| | | { |
| | | LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | await LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | var config = SkillConfig.Get(skillID); |
| | | if (config == null) |
| | | { |
| | |
| | | } |
| | | |
| | | GameObject cellContainer; |
| | | protected void LoadPrefab() |
| | | protected async UniTask LoadPrefab() |
| | | { |
| | | if (cellContainer != null) |
| | | return; |
| | |
| | | } |
| | | if (cellContainer == null) |
| | | { |
| | | cellContainer = UIUtility.CreateWidget("SkillWordCell", "Container_SkillCell"); |
| | | cellContainer = await UIUtility.CreateWidget("SkillWordCell", "Container_SkillCell"); |
| | | |
| | | if (this == null) |
| | | { |
| | | if (null != cellContainer) |
| | | { |
| | | DestroyImmediate(cellContainer); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | if (cellContainer != null) |
| | | { |