You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.9 KiB
80 lines
1.9 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class ExitModeSet : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
/// <summary>
|
||
|
/// 退出
|
||
|
/// </summary>
|
||
|
|
||
|
private bool Flag = true;
|
||
|
private Animator Ani;
|
||
|
private Button MyButton;
|
||
|
private Toggle TheExit;// 退出
|
||
|
private Text TheShowText;
|
||
|
public static ExitModeSet instance;
|
||
|
|
||
|
void Awake()
|
||
|
{
|
||
|
if (instance == null)
|
||
|
{
|
||
|
instance = this;
|
||
|
}
|
||
|
}
|
||
|
void Start()
|
||
|
{
|
||
|
Ani = this.gameObject.GetComponent<Animator>();
|
||
|
MyButton = this.gameObject.GetComponent<Button>();
|
||
|
MyButton.onClick.AddListener(PressBtn);
|
||
|
TheExit = this.gameObject.transform.Find("Grid").Find("退出登录").GetComponent<Toggle>();
|
||
|
TheExit.onValueChanged.AddListener(TheExitWay);
|
||
|
|
||
|
if(ExamInfoHelpClass.loadSceneMode== ExamInfoHelpClass.LoadSceneMode.CheckAnswer)
|
||
|
{
|
||
|
TimeManager.TimeOutEvent += TimeManager_TimeOutEvent;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void TimeManager_TimeOutEvent(object sender, System.EventArgs e)
|
||
|
{
|
||
|
TimeManager.TimeOutEvent -= TimeManager_TimeOutEvent;
|
||
|
MySceneManager.BackToLastScene();
|
||
|
}
|
||
|
|
||
|
public void PressBtn()
|
||
|
{
|
||
|
if (Flag)
|
||
|
{
|
||
|
Ani.CrossFade("ExitHide", 0);
|
||
|
Flag = false;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Ani.CrossFade("ExitShow", 0);
|
||
|
Flag = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public void TheExitWay(bool check)// 退出
|
||
|
{
|
||
|
GameObject TipWindow = Instantiate(Resources.Load<GameObject>("UIPrefab/TipWindow"));
|
||
|
TipWindow.GetComponent<TipWindowManager>().SetWindow(
|
||
|
"是否退出场景?", new UnityEngine.Events.UnityAction(OKSubmit), new UnityEngine.Events.UnityAction(NOSubmit));
|
||
|
}
|
||
|
private void OKSubmit()
|
||
|
{
|
||
|
Back();
|
||
|
}
|
||
|
private void NOSubmit()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public void Back()
|
||
|
{
|
||
|
MySceneManager.BackToLastScene();
|
||
|
}
|
||
|
}
|