12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public enum ETab
- {
- A, B
- }
- public class Test : MonoBehaviour
- {
- private TabButtonGroup m_TabGroup;
- void Start()
- {
- m_TabGroup = new TabButtonGroup();
- Transform A = transform.Find("A");
- NormalTabButton AButton = new NormalTabButton(this.m_TabGroup);
- AButton.GameObject = A.gameObject;
- Transform B = transform.Find("B");
- NormalTabButton BButton = new NormalTabButton(this.m_TabGroup);
- BButton.GameObject = B.gameObject;
- m_TabGroup.Select(0);
- m_TabGroup.OnSelect += OnTabSelect;
- }
- private void OnTabSelect(int tab)
- {
- if (tab == (int)ETab.A)
- {
- Debug.Log("AA");
- }
- else if (tab == (int)ETab.B)
- {
- Debug.Log("BB");
- }
- }
- }
|