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.
231 lines
7.0 KiB
231 lines
7.0 KiB
3 years ago
|
using AX.MessageSystem;
|
||
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.TrackRecord;
|
||
|
using System;
|
||
|
|
||
|
public class ExamineModeSet : MonoBehaviour
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 考核模式
|
||
|
/// </summary>
|
||
|
|
||
|
private bool Flag = true;
|
||
|
private Animator Ani;
|
||
|
private Button MyButton;
|
||
|
private Toggle TheJiaoJuan;// 保存课件
|
||
|
private Toggle TheClear;// 一键清空
|
||
|
private Toggle TheHideName;// 隐藏名称
|
||
|
private Toggle TheTool;// 辅助工具
|
||
|
private Toggle TheExit;// 退出
|
||
|
private Text HourLable;
|
||
|
private Text MinLabele;
|
||
|
private Text SecondLable;
|
||
|
public float time;
|
||
|
public static int hours;
|
||
|
public static int minutes;
|
||
|
public static int seconds;
|
||
|
public bool stopped = true;
|
||
|
private Text TheShowText;
|
||
|
private GameObject Template;//辅助工具的父物体
|
||
|
public static ExamineModeSet instance;
|
||
|
private CeJuScript CeJu;
|
||
|
public Record_One_root Record = new Record_One_root();
|
||
|
void Awake()
|
||
|
{
|
||
|
if (instance == null)
|
||
|
{
|
||
|
instance = this;
|
||
|
}
|
||
|
}
|
||
|
void Start ()
|
||
|
{
|
||
|
|
||
|
Ani = this.gameObject.GetComponent<Animator>();
|
||
|
MyButton = this.gameObject.GetComponent<Button>();
|
||
|
MyButton.onClick.AddListener(PressBtn);
|
||
|
|
||
|
TheJiaoJuan = this.gameObject.transform.Find("Grid").Find("交卷").GetComponent<Toggle>();
|
||
|
TheClear = this.gameObject.transform.Find("Grid").Find("一键清空").GetComponent<Toggle>();
|
||
|
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>();
|
||
|
|
||
|
HourLable = this.gameObject.transform.Find("Time").Find("Hour").GetComponent<Text>();
|
||
|
MinLabele = this.gameObject.transform.Find("Time").Find("Min").GetComponent<Text>();
|
||
|
SecondLable = this.gameObject.transform.Find("Time").Find("Second").GetComponent<Text>();
|
||
|
TheShowText = TheHideName.transform.Find("Background").Find("Text").GetComponent<Text>();
|
||
|
CeJu = TheTool.GetComponent<CeJuScript>();
|
||
|
Template = TheTool.transform.Find("Template").gameObject;
|
||
|
|
||
|
TheJiaoJuan.onValueChanged.AddListener(TheJiaoJuanWay);
|
||
|
TheClear.onValueChanged.AddListener(TheClearWay);
|
||
|
TheHideName.onValueChanged.AddListener(TheHideNameWay);
|
||
|
TheTool.onValueChanged.AddListener(TheToolWay);
|
||
|
TheExit.onValueChanged.AddListener(TheExitWay);
|
||
|
|
||
|
hours = 0;
|
||
|
minutes = 0;
|
||
|
seconds = 0;
|
||
|
}
|
||
|
|
||
|
public void PressBtn()
|
||
|
{
|
||
|
if (Flag)
|
||
|
{
|
||
|
Ani.CrossFade("ExamineHide", 0);
|
||
|
Flag = false;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Ani.CrossFade("ExamineShow", 0);
|
||
|
Flag = true;
|
||
|
}
|
||
|
}
|
||
|
public void TheJiaoJuanWay(bool check)// 交卷
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public void TheClearWay(bool check)// 一键清空
|
||
|
{
|
||
|
RecordManager.Instance.IsPause = true;
|
||
|
GameObject TipWindow = Instantiate(Resources.Load<GameObject>("UIPrefab/TipWindow"));
|
||
|
TipWindow.GetComponent<TipWindowManager>().SetWindow(
|
||
|
"重置后无法恢复,确定重置 ?", new UnityEngine.Events.UnityAction(OKReset), new UnityEngine.Events.UnityAction(NOReset));
|
||
|
|
||
|
}
|
||
|
|
||
|
private void NOReset()
|
||
|
{
|
||
|
RecordManager.Instance.IsPause = false;
|
||
|
}
|
||
|
|
||
|
private void OKReset()
|
||
|
{
|
||
|
EquipSubmit.costSelectedEquips.Clear();
|
||
|
EquipSubmit.unCostSelectedEquips.Clear();
|
||
|
MessageDispatcher.SendMessage("DestroyObj", (object)"All");
|
||
|
MessageDispatcher.SendMessage("clearTrigger", (object)"");
|
||
|
MessageDispatcher.SendMessage("ResetTheScene");
|
||
|
//InstantiationTool.Instance.RSDToggle.isOn = false;
|
||
|
MessageDispatcher.SendMessage("ResettingButton");
|
||
|
MessageDispatcher.SendMessage("ShuiPaoMessage");
|
||
|
MessageDispatcher.SendMessage("Operatinghints", (object)"场景重置成功");
|
||
|
MessageDispatcher.SendMessage("RESET_OILTANKDISASTER_ATRRI", (object)"All");//重置所有罐体
|
||
|
SetSceneFromXmlPath("Questions");
|
||
|
//加载考题灾情
|
||
|
//TrackRecordHelpClass.LoadObjSetToOriginalTrans(Record);
|
||
|
LoadManager.Instance.LoadObjSetToOriginalTrans(Record);
|
||
|
//开始记录
|
||
|
RecordManager.Instance.StartRecord();
|
||
|
}
|
||
|
|
||
|
private void SetSceneFromXmlPath(string path)
|
||
|
{
|
||
|
Record = null;
|
||
|
string filename = BaseItemManager.CurQues.ID + "/" + BaseItemManager.CurQues.FilePath;
|
||
|
Record = TrackRecordHelpClass.LoadRecord_DeserializeXMLToRecord(path + "/" + filename); //该函数的默认路径待修改
|
||
|
}
|
||
|
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();
|
||
|
}
|
||
|
void Update()
|
||
|
{
|
||
|
if (stopped)
|
||
|
return;
|
||
|
|
||
|
time += Time.deltaTime;
|
||
|
|
||
|
if (time >= 1.0f)
|
||
|
{
|
||
|
seconds += 1;
|
||
|
|
||
|
if (seconds >= 60)
|
||
|
{
|
||
|
minutes += 1;
|
||
|
|
||
|
if (minutes >= 60)
|
||
|
{
|
||
|
hours += 1;
|
||
|
|
||
|
if (hours >= 24)
|
||
|
hours = 0;
|
||
|
|
||
|
minutes = 0;
|
||
|
}
|
||
|
|
||
|
seconds = 0;
|
||
|
}
|
||
|
|
||
|
time = 0.0f;
|
||
|
}
|
||
|
if (hours > 9)
|
||
|
{
|
||
|
HourLable.text = hours.ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
HourLable.text = "0" + hours.ToString();
|
||
|
}
|
||
|
if (minutes > 9)
|
||
|
{
|
||
|
MinLabele.text = minutes.ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
MinLabele.text = "0" + minutes.ToString();
|
||
|
}
|
||
|
if (seconds > 9)
|
||
|
{
|
||
|
SecondLable.text = seconds.ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
SecondLable.text = "0" + seconds.ToString();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|