102 lines
2.1 KiB
C#
102 lines
2.1 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using static UnityEditor.Progress;
|
||
|
||
public class JiShuZhenDiPage : UIPageBtnEventBase
|
||
{
|
||
public List<GameObject> myPages=new List<GameObject>();
|
||
|
||
|
||
|
||
public override void OnF1Click()
|
||
{
|
||
base.OnF1Click();
|
||
F1Event();
|
||
//F1需要根据不同的界面执行不同的逻辑,待定
|
||
}
|
||
|
||
public override void OnF2Click()
|
||
{
|
||
base.OnF2Click();
|
||
|
||
//F2需要根据不同的界面执行不同的逻辑,待定
|
||
}
|
||
|
||
|
||
public override void OnF3Click()
|
||
{
|
||
base.OnF3Click();
|
||
//F3是上一页
|
||
Previous();
|
||
|
||
}
|
||
|
||
public override void OnF4Click()
|
||
{
|
||
base.OnF4Click();
|
||
Next();
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 本界面的F1设置
|
||
/// </summary>
|
||
void F1Event()
|
||
{
|
||
switch (myPages[currentIndex].name)
|
||
{
|
||
case "1-系统巡检":
|
||
|
||
myPages[currentIndex].transform.GetChild(0).gameObject.SetActive(false);
|
||
myPages[currentIndex].transform.GetChild(1).gameObject.SetActive(true);
|
||
break;
|
||
}
|
||
}
|
||
|
||
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);
|
||
}
|
||
}
|