110 lines
2.7 KiB
C#
110 lines
2.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ZhuJieMianPage : UIPageBtnEventBase
|
|
{
|
|
|
|
public List<GameObject> pages=new List<GameObject>();
|
|
|
|
public GameObject JiShuZhenDiUI; //技术阵地UI
|
|
public GameObject 行军导航UI;
|
|
|
|
private List<bool> clickState=new List<bool>();
|
|
|
|
private void Awake()
|
|
{
|
|
for (int i = 0; i < pages.Count; i++)
|
|
{
|
|
clickState.Add(false);
|
|
}
|
|
//clickState[0] = true;
|
|
}
|
|
|
|
public override void OnF1Click()
|
|
{
|
|
base.OnF1Click();
|
|
//pages[0].SetActive(true);
|
|
InstancePage(0);
|
|
JiShuZhenDiUI.SetActive(true);
|
|
//gameObject.SetActive(false);
|
|
gameObject.transform.parent.gameObject.SetActive(false);
|
|
}
|
|
|
|
public override void OnF2Click()
|
|
{
|
|
base.OnF2Click();
|
|
//pages[1].SetActive(true);
|
|
//if (clickState[0] == false)
|
|
//{
|
|
// ErrorTip.Instance.ShowErrorTip("请先完成上级功能操作!");
|
|
// return;
|
|
//}
|
|
|
|
InstancePage(1);
|
|
行军导航UI.SetActive(true);
|
|
|
|
//gameObject.SetActive(false);
|
|
gameObject.transform.parent.gameObject.SetActive(false);
|
|
}
|
|
|
|
public override void OnF3Click()
|
|
{
|
|
base.OnF3Click();
|
|
//if (clickState[1] == false)
|
|
//{
|
|
// ErrorTip.Instance.ShowErrorTip("请先完成上级功能操作!");
|
|
// return;
|
|
//}
|
|
//pages[2].SetActive(true);
|
|
InstancePage(2);
|
|
//gameObject.SetActive(false);
|
|
gameObject.transform.parent.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
public override void OnF4Click()
|
|
{
|
|
base.OnF4Click();
|
|
//if (clickState[2] == false)
|
|
//{
|
|
// ErrorTip.Instance.ShowErrorTip("请先完成上级功能操作!");
|
|
// return;
|
|
//}
|
|
//pages[3].SetActive(true);
|
|
InstancePage(3);
|
|
//gameObject.SetActive(false);
|
|
gameObject.transform.parent.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
public override void OnF5Click()
|
|
{
|
|
base.OnF5Click();
|
|
//if (clickState[3] == false)
|
|
//{
|
|
// ErrorTip.Instance.ShowErrorTip("请先完成上级功能操作!");
|
|
// return;
|
|
//}
|
|
//pages[4].SetActive(true);
|
|
InstancePage(4);
|
|
//ameObject.SetActive(false);
|
|
gameObject.transform.parent.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
GameObject currectPage;
|
|
public Transform pageParent;
|
|
int currectIndex;
|
|
|
|
public void InstancePage(int index)
|
|
{
|
|
if(currectPage!=null)
|
|
Destroy(currectPage);
|
|
currectPage=Instantiate(pages[index], pageParent);
|
|
currectIndex = index;
|
|
currectPage.SetActive(true);
|
|
clickState[index] = true;
|
|
}
|
|
}
|