100 lines
2.2 KiB
C#
100 lines
2.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
public class UIPanelEvent : MonoBehaviour
|
|
{
|
|
public List<GameObject> allPages=new List<GameObject>();
|
|
public ModelBtnManager modelBtnManager;
|
|
private void OnEnable()
|
|
{
|
|
//modelBtnManager.SetButtonAction(ButtonType.F1, OnShowPage)
|
|
|
|
}
|
|
// Start is called before the first frame update
|
|
|
|
|
|
|
|
public void F1Event()
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|