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.
258 lines
7.7 KiB
258 lines
7.7 KiB
using UnityEngine; |
|
using System.Collections; |
|
using UnityEngine.UI; |
|
using AX.MessageSystem; |
|
using AX.TrackRecord; |
|
using System.Collections.Generic; |
|
using AX.NetworkSystem; |
|
public class MakeSorceSet : MonoBehaviour { |
|
|
|
|
|
/// <summary> |
|
/// 评分模式 |
|
/// </summary> |
|
|
|
private bool Flag = true; |
|
private Animator Ani; |
|
private Button MyButton; |
|
private Toggle TheJiaoJuan;// 保存课件 |
|
private Toggle CheckRenWu;// 任务查询 |
|
private Toggle TheHideName;// 隐藏名称 |
|
private Toggle TheTool;// 辅助工具 |
|
private Toggle TheExit;// 退出 |
|
//private Text HourLable; |
|
//private Text MinLabele; |
|
//private Text SecondLable; |
|
public float time; |
|
private int hours; |
|
private int minutes; |
|
private int seconds; |
|
//public bool stopped = true; |
|
private Text TheShowText; |
|
private GameObject Template;//辅助工具的父物体 |
|
public static MakeSorceSet instance; |
|
private CeJuScript CeJu; |
|
private GameObject TheCheckPlane; |
|
[HideInInspector] |
|
public GameObject EditSaveButton; |
|
public List<ScoreInfo> ScoreList = new List<ScoreInfo>(); |
|
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>(); |
|
CheckRenWu = 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.FindChild("Time").FindChild("Hour").GetComponent<Text>(); |
|
//MinLabele = this.gameObject.transform.FindChild("Time").FindChild("Min").GetComponent<Text>(); |
|
//SecondLable = this.gameObject.transform.FindChild("Time").FindChild("Second").GetComponent<Text>(); |
|
TheShowText = TheHideName.transform.Find("Background").Find("Text").GetComponent<Text>(); |
|
CeJu = TheTool.GetComponent<CeJuScript>(); |
|
Template = TheTool.transform.Find("Template").gameObject; |
|
|
|
EditSaveButton = GameObject.Find("Canvas").transform.Find("MakeScoreStudentList").Find("EditSaveButton").gameObject; |
|
TheCheckPlane = GameObject.Find("Canvas").transform.Find("查询任务面板").gameObject; |
|
TheJiaoJuan.onValueChanged.AddListener(TheJiaoJuanWay); |
|
CheckRenWu.onValueChanged.AddListener(CheckRenWuWay); |
|
TheHideName.onValueChanged.AddListener(TheHideNameWay); |
|
TheTool.onValueChanged.AddListener(TheToolWay); |
|
TheExit.onValueChanged.AddListener(TheExitWay); |
|
|
|
TimerWin = GameObject.Find("Canvas").transform.Find("考核模式倒计时").gameObject; |
|
TimerWin.SetActive(true); |
|
} |
|
bool CanLook = false; |
|
|
|
public void PressBtn() |
|
{ |
|
if (Flag) |
|
{ |
|
Ani.CrossFade("PrepareHide", 0); |
|
Flag = false; |
|
} |
|
else |
|
{ |
|
Ani.CrossFade("PrepareShow", 0); |
|
Flag = true; |
|
} |
|
} |
|
public void TheJiaoJuanWay(bool check)// 交卷 |
|
{ |
|
if (GameObject.Find("Canvas").transform.Find("时间轴").gameObject.activeInHierarchy) |
|
{ |
|
MessageDispatcher.SendMessage("Operatinghints", (object)"请保存评分后上传"); |
|
return; |
|
} |
|
if (ScoreList.Count == 0) |
|
{ |
|
MessageDispatcher.SendMessage("Operatinghints", (object)"请评分后上传"); |
|
return; |
|
} |
|
GameObject TipWindow = Instantiate(Resources.Load<GameObject>("UIPrefab/TipWindow")); |
|
TipWindow.GetComponent<TipWindowManager>().SetWindow( |
|
"是否上传评分?", new UnityEngine.Events.UnityAction(OKSumbit), new UnityEngine.Events.UnityAction(NOSumbit)); |
|
} |
|
public void OKSumbit() |
|
{ |
|
if (TimeManager.RemainSeconds < 0) |
|
{ |
|
MessageDispatcher.SendMessage("Operatinghints", (object)"评分时间结束无法上传"); |
|
return; |
|
} |
|
for (int i = 0; i < ScoreList.Count; i++) |
|
{ |
|
NetworkManager.Default.SendRequestAsync("MARKING_SAVE_REQUEST", ScoreList[i]);//评分请求 |
|
} |
|
|
|
} |
|
public void NOSumbit() |
|
{ |
|
|
|
} |
|
public void CheckRenWuWay(bool check)// 任务查询 |
|
{ |
|
if (CanLook) |
|
{ |
|
TheCheckPlane.SetActive(true); |
|
InstanceRecordPlane.instance_.OpenThisPlane(); |
|
} |
|
else |
|
{ |
|
MessageDispatcher.SendMessage("Operatinghints", (object)"打分过程可以查看"); |
|
|
|
} |
|
} |
|
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(); |
|
} |
|
//public void MakeSorceSetTime() |
|
//{ |
|
// stopped = true; |
|
// HourLable.text ="00"; |
|
// MinLabele.text = "00"; |
|
// SecondLable.text = "00"; |
|
//} |
|
|
|
public int Speed=1; |
|
private GameObject TimerWin; |
|
|
|
void Update() |
|
{ |
|
|
|
if (LoadManager.Instance.IsPlayBacking) |
|
{ |
|
CanLook = true; |
|
} |
|
else |
|
{ |
|
CanLook = false; |
|
} |
|
//if (stopped) |
|
// return; |
|
|
|
//time += Time.deltaTime * Speed; |
|
|
|
//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(); |
|
//} |
|
} |
|
|
|
}
|
|
|