E_ElecCompetition/Electrical_inspectionCompet.../Assets/Adam/Scripts/MobileTerminalController.cs

66 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//============================================================
//支持中文文件使用UTF-8编码
//@author #AUTHOR#
//@create #CREATEDATE#
//@company #COMPANY#
//
//@description:
//============================================================
public class MobileTerminalController : MonoBehaviour
{
public InputField number;
public Button outsideBtn;
public Button electricitBtn;
public Button backBtn;
public GameObject outsideView;
public GameObject electrcitView;
public Text outsideInfo;
public Text electrcitInfo;
// Use this for initialization
private void Start()
{
outsideBtn.onClick.AddListener(OnOutsideView);
electricitBtn.onClick.AddListener(OnElectricitView);
backBtn.onClick.AddListener(OnBack);
SwitchView(-1);
}
public void OnElectricitView()
{
SwitchView(0);
}
public void OnOutsideView()
{
SwitchView(1);
}
public void SwitchView(int index)
{
electrcitView.SetActive(index == 0);
outsideView.SetActive(index == 1);
if (index == 0 || index == 1)
{
backBtn.gameObject.SetActive(true);
}
else
{
backBtn.gameObject.SetActive(false);
}
}
public void OnBack()
{
SwitchView(-1);
}
}