| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | public class BattleBuffCell : MonoBehaviour |
| | | { |
| | |
| | | |
| | | GameObject cellContainer; |
| | | |
| | | private void LoadPrefab() |
| | | private async UniTask LoadPrefab() |
| | | { |
| | | if (cellContainer != null) |
| | | return; |
| | |
| | | |
| | | if (cellContainer == null) |
| | | { |
| | | cellContainer = UIUtility.CreateWidget("BattleBuffCell", "Container_BuffCell"); |
| | | cellContainer = await UIUtility.CreateWidget("BattleBuffCell", "Container_BuffCell"); |
| | | if (this == null) |
| | | { |
| | | if (null != cellContainer) |
| | | { |
| | | DestroyImmediate(cellContainer); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | if (cellContainer != null) |
| | | { |
| | | cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one); |
| | |
| | | // cellContainer.transform.localScale = cellContainer.transform.localScale * scale; |
| | | } |
| | | |
| | | public void Init(HB428_tagSCBuffRefresh buffData, Action onclick = null, bool showType = false) |
| | | public async UniTask Init(HB428_tagSCBuffRefresh buffData, Action onclick = null, bool showType = false) |
| | | { |
| | | if (null == buffData || gameObject == null) |
| | | { |
| | | return; |
| | | } |
| | | LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | await LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | var config = SkillConfig.Get((int)buffData.SkillID); |
| | | if (config == null) |
| | | { |