| | |
| | | |
| | | // 底部按钮组 |
| | | private Button[] bottomTabButtons; |
| | | |
| | | private GameObject[] bottomTabEffects; |
| | | |
| | | // 当前选中的底部标签索引 |
| | | private int currentTabIndex = 0; |
| | |
| | | windowBackground = transform.Find("RawImgBackground").gameObject; |
| | | |
| | | bottomTabButtons = new Button[5]; |
| | | |
| | | for (int i = 1; i <= 5; i++) |
| | | { |
| | | string buttonName = "Buttons/Button" + i; |
| | | bottomTabButtons[i-1] = transform.Find(buttonName).GetComponent<Button>(); |
| | | #if UNITY_EDITOR |
| | | //测试代码 |
| | | #endif |
| | | } |
| | | |
| | | // 初始化UI组件事件 |
| | |
| | | OnBottomTabButtonClicked(index); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | protected override void OnOpen() |
| | |
| | | UpdatePlayerInfo(); |
| | | UpdateCurrency(); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | base.OnPreOpen(); |
| | | bottomTabEffects = new GameObject[bottomTabButtons.Length]; |
| | | for (int i = 0; i < bottomTabButtons.Length; i++) |
| | | { |
| | | bottomTabEffects[i] = PlayUIEffect(1004, bottomTabButtons[i].transform, false); |
| | | } |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | base.OnPreClose(); |
| | | foreach (var effectGO in bottomTabEffects) |
| | | { |
| | | DestroyImmediate(effectGO); |
| | | } |
| | | bottomTabEffects = null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新玩家信息 |