using System.Collections; using System.Collections.Generic; using UnityEngine; public class DemoUi : MonoBehaviour { public List allPages = new List(); // Start is called before the first frame update public void F1Event() { Debug.Log(11); foreach (var page in allPages) { page.SetActive(false); } allPages[0].SetActive(true); } public void F2Event() { foreach (var page in allPages) { page.SetActive(false); } allPages[1].SetActive(true); } public void F3Event() { foreach (var page in allPages) { page.SetActive(false); } allPages[2].SetActive(true); } public void F4Event() { foreach (var page in allPages) { page.SetActive(false); } allPages[3].SetActive(true); } public void F5Event() { foreach (var page in allPages) { page.SetActive(false); } allPages[4].SetActive(true); } public void F6Event() { foreach (var page in allPages) { page.SetActive(false); } allPages[5].SetActive(true); } public void OnShowPage(ButtonType type) { foreach (var page in allPages) { page.SetActive(false); } switch (type) { case ButtonType.F1: allPages[0].SetActive(true); break; case ButtonType.F2: allPages[1].SetActive(true); break; case ButtonType.F3: allPages[2].SetActive(true); break; case ButtonType.F4: allPages[3].SetActive(true); break; case ButtonType.F5: allPages[4].SetActive(true); break; case ButtonType.F6: allPages[5].SetActive(true); break; } } }