227 lines
5.3 KiB
C#
227 lines
5.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SheJiXiuZhengPage : UIPageBtnEventBase
|
|
{
|
|
public List<GameObject> myPages = new List<GameObject>();
|
|
|
|
|
|
public GameObject 炸点修正;
|
|
public GameObject 诸元修正;
|
|
public GameObject 炸点修正解算;
|
|
public GameObject 射击修正下级;
|
|
public GameObject 射击控制;
|
|
public GameObject 诸元射击控制;
|
|
|
|
public Stack<GameObject> pageStack = new Stack<GameObject>();
|
|
// 当前显示的页面
|
|
private GameObject currentPage;
|
|
|
|
|
|
public string currectName;
|
|
|
|
private void OnEnable()
|
|
{
|
|
//pageStack.Clear();
|
|
//currectName = "";
|
|
//OpenPage(射击修正下级);
|
|
}
|
|
|
|
GameObject shejiControl;
|
|
public Transform controlParent;
|
|
public override void OnF1Click()
|
|
{
|
|
base.OnF1Click();
|
|
|
|
Debug.Log("炸点修正");
|
|
|
|
//if (currectName == "射击控制")
|
|
// return;
|
|
//诸元修正.SetActive(true);
|
|
//currectName = "诸元修正";
|
|
if (currectName == "炸点修正解算")
|
|
{
|
|
//OpenPage(射击控制);
|
|
shejiControl = Instantiate(射击控制, controlParent);
|
|
shejiControl.GetComponent<SheJiControl>().mono = this;
|
|
shejiControl.SetActive(true);
|
|
//射击控制.SetActive(true);
|
|
//currectName = "射击控制";
|
|
//AnimationModel.instance.Show181Tween();
|
|
return;
|
|
|
|
}
|
|
if (currectName == "诸元修正")
|
|
{
|
|
//OpenPage(诸元射击控制);
|
|
shejiControl = Instantiate(射击控制, controlParent);
|
|
shejiControl.GetComponent<SheJiControl>().mono = this;
|
|
shejiControl.SetActive(true);
|
|
//诸元射击控制.SetActive(true);
|
|
//currectName = "射击控制";
|
|
Debug.Log("打开诸元射击控制页面");
|
|
return;
|
|
}
|
|
|
|
|
|
//如果在炸点修正界面点击F1则解算
|
|
if (炸点修正.activeInHierarchy)
|
|
{
|
|
OpenPage(炸点修正解算);
|
|
炸点修正解算.SetActive(true);
|
|
currectName = "炸点修正解算";
|
|
return;
|
|
}
|
|
OpenPage(炸点修正);
|
|
//炸点修正.SetActive(true);
|
|
currectName = "炸点修正";
|
|
|
|
|
|
|
|
}
|
|
|
|
public override void OnF2Click()
|
|
{
|
|
base.OnF2Click();
|
|
OpenPage(诸元修正);
|
|
currectName = "诸元修正";
|
|
}
|
|
|
|
public override void OnF3Click()
|
|
{
|
|
base.OnF3Click();
|
|
//if (currectName == "射击控制")
|
|
// return;
|
|
//射击修正下级.SetActive(true);
|
|
//currectName = "射击修正下级";
|
|
OpenPage(射击修正下级);
|
|
currectName = "";
|
|
}
|
|
|
|
//F4返回上一个
|
|
public override void OnF4Click()
|
|
{
|
|
base.OnF4Click();
|
|
if (pageStack.Count == 0)
|
|
{
|
|
射击修正下级.SetActive (false);
|
|
gameObject.SetActive(false);
|
|
return;
|
|
}
|
|
GoBack();
|
|
//if (currectName == "炸点修正解算")
|
|
//{
|
|
// OpenPage(炸点修正);
|
|
// currectName = "炸点修正";
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开页面
|
|
/// </summary>
|
|
public void OpenPage(GameObject page)
|
|
{
|
|
if (page == null) return;
|
|
|
|
// 当前页面入栈
|
|
if (currentPage != null)
|
|
{
|
|
pageStack.Push(currentPage);
|
|
currentPage.SetActive(false);
|
|
}
|
|
|
|
// 打开新页面
|
|
page.SetActive(true);
|
|
currentPage = page;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 返回上一页
|
|
/// </summary>
|
|
public void GoBack()
|
|
{
|
|
if (pageStack.Count == 0) return;
|
|
|
|
// 关闭当前页面
|
|
if (currentPage != null)
|
|
currentPage.SetActive(false);
|
|
|
|
// 弹出上一页并显示
|
|
currentPage = pageStack.Pop();
|
|
currentPage.SetActive(true);
|
|
if(currentPage== 炸点修正)
|
|
currectName = "炸点修正";
|
|
if (currentPage == 炸点修正解算)
|
|
currectName = "炸点修正解算";
|
|
if (currentPage == 诸元修正)
|
|
currectName = "诸元修正";
|
|
if (currentPage == 射击修正下级)
|
|
currectName = "";
|
|
|
|
//if (currentPage == 诸元修正)
|
|
// currectName = "诸元修正";
|
|
}
|
|
|
|
/// <summary>
|
|
/// 清空页面记录
|
|
/// </summary>
|
|
public void ClearHistory()
|
|
{
|
|
pageStack.Clear();
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
//ClearHistory();
|
|
}
|
|
|
|
|
|
private int currentIndex = 0;
|
|
|
|
/// <summary>
|
|
/// 切换到下一个元素
|
|
/// </summary>
|
|
public void Next()
|
|
{
|
|
if (myPages == null || myPages.Count == 0) return;
|
|
|
|
// 如果是最后一个元素,则不进行操作
|
|
if (currentIndex >= myPages.Count - 1) return;
|
|
|
|
// 隐藏当前元素
|
|
if (myPages[currentIndex] != null)
|
|
myPages[currentIndex].SetActive(false);
|
|
|
|
currentIndex++;
|
|
|
|
// 显示下一个元素
|
|
if (myPages[currentIndex] != null)
|
|
myPages[currentIndex].SetActive(true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 切换到上一个元素
|
|
/// </summary>
|
|
public void Previous()
|
|
{
|
|
if (myPages == null || myPages.Count == 0) return;
|
|
|
|
// 如果是第一个元素,则不进行操作
|
|
if (currentIndex <= 0) return;
|
|
|
|
// 隐藏当前元素
|
|
if (myPages[currentIndex] != null)
|
|
myPages[currentIndex].SetActive(false);
|
|
|
|
currentIndex--;
|
|
|
|
// 显示上一个元素
|
|
if (myPages[currentIndex] != null)
|
|
myPages[currentIndex].SetActive(true);
|
|
}
|
|
}
|