66 lines
1.4 KiB
C#
66 lines
1.4 KiB
C#
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);
|
||
}
|
||
}
|