using UnityEngine; using UnityEngine.UI; using System; using Cysharp.Threading.Tasks; // 一级界面带预制体,底部功能按钮样式 public class OneLevelWin : FunctionsBaseWin { [NonSerialized] GroupButtonEx tabBtn; public FuncBtnData[] funcBtnDatas; [NonSerialized] Button closeBtn; bool isComponentReady = false; protected override void InitComponent() { InitComponentAsync().Forget(); } protected override void OnPreOpen() { if (!isComponentReady) { WaitReadyThenOpen().Forget(); return; } base.OnPreOpen(); } private async UniTaskVoid WaitReadyThenOpen() { await UniTask.WaitUntil(() => isComponentReady || this == null); if (this == null) return; base.OnPreOpen(); } private async UniTask InitComponentAsync() { // 创建 var instance = await UIUtility.CreateWidget("OneLevelWin", "BottomTabs"); if (this == null) { if (instance != null) DestroyImmediate(instance); return; } instance.transform.SetParent(_rectTransform, false); closeBtn = _rectTransform.GetComponent