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.
103 lines
3.1 KiB
103 lines
3.1 KiB
3 years ago
|
using AX.MessageSystem;
|
||
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.UI;
|
||
|
public class CoursewareModeSet : MonoBehaviour
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 课件学习
|
||
|
/// </summary>
|
||
|
|
||
|
private bool Flag = true;
|
||
|
private Animator Ani;
|
||
|
private Button MyButton;
|
||
|
private Toggle TheHideName;// 隐藏名称
|
||
|
private Toggle TheTool;// 辅助工具
|
||
|
private Toggle TheExit;// 退出
|
||
|
private Text TheShowText;
|
||
|
private GameObject Template;//辅助工具的父物体
|
||
|
public static CoursewareModeSet instance;
|
||
|
private CeJuScript CeJu;
|
||
|
void Awake()
|
||
|
{
|
||
|
if (instance == null)
|
||
|
{
|
||
|
instance = this;
|
||
|
}
|
||
|
}
|
||
|
void Start ()
|
||
|
{
|
||
|
Ani = this.gameObject.GetComponent<Animator>();
|
||
|
MyButton = this.gameObject.GetComponent<Button>();
|
||
|
MyButton.onClick.AddListener(PressBtn);
|
||
|
TheHideName = this.gameObject.transform.Find("Grid").Find("隐藏名称").GetComponent<Toggle>();
|
||
|
TheTool = this.gameObject.transform.Find("Grid").Find("辅助工具").GetComponent<Toggle>();
|
||
|
TheExit = this.gameObject.transform.Find("Grid").Find("退出登录").GetComponent<Toggle>();
|
||
|
TheShowText = TheHideName.transform.Find("Background").Find("Text").GetComponent<Text>();
|
||
|
Template = TheTool.transform.Find("Template").gameObject;
|
||
|
TheHideName.onValueChanged.AddListener(TheHideNameWay);
|
||
|
TheTool.onValueChanged.AddListener(TheToolWay);
|
||
|
TheExit.onValueChanged.AddListener(TheExitWay);
|
||
|
CeJu = TheTool.GetComponent<CeJuScript>();
|
||
|
}
|
||
|
|
||
|
public void PressBtn()
|
||
|
{
|
||
|
if (Flag)
|
||
|
{
|
||
|
Ani.CrossFade("CoursewareHide", 0);
|
||
|
Flag = false;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Ani.CrossFade("CoursewareShow", 0);
|
||
|
Flag = true;
|
||
|
}
|
||
|
}
|
||
|
public void TheHideNameWay(bool check)// 隐藏名称
|
||
|
{
|
||
|
if (TheShowText.text == "隐藏名称")
|
||
|
{
|
||
|
TheShowText.text = "显示名称";
|
||
|
UIController.instance.NameControl = false;
|
||
|
MessageDispatcher.SendMessage("NameControl", (object)false);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
TheShowText.text = "隐藏名称";
|
||
|
UIController.instance.NameControl = true;
|
||
|
MessageDispatcher.SendMessage("NameControl", (object)true);
|
||
|
}
|
||
|
}
|
||
|
public void TheToolWay(bool check)// 辅助工具
|
||
|
{
|
||
|
if (check)
|
||
|
{
|
||
|
Template.SetActive(true);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Template.SetActive(false);
|
||
|
CeJu.Set();
|
||
|
}
|
||
|
}
|
||
|
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();
|
||
|
}
|
||
|
|
||
|
}
|