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.
92 lines
3.2 KiB
92 lines
3.2 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using AX.TrackRecord;
|
||
|
using System;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.NetworkSystem;
|
||
|
|
||
|
|
||
|
//public static class TimeManager
|
||
|
//{
|
||
|
// public static float RemainSeconds = -10;//记录当前考试的剩余时间
|
||
|
// public static ExaminationInfo CurExam = null;//记录当前正在作答的考试
|
||
|
// public static float TipTime = 30;
|
||
|
|
||
|
//}
|
||
|
|
||
|
public class SubmitAnswer : MonoBehaviour {
|
||
|
GameObject TimerWin;
|
||
|
void Start()
|
||
|
{
|
||
|
TimerWin = GameObject.Find("Canvas").transform.Find("考核模式倒计时").gameObject;
|
||
|
if (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.ExamineMode)
|
||
|
{
|
||
|
TimerWin.SetActive(true);
|
||
|
TimeManager.TimeOutEvent += TimerManager_TimeOutEvent;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void TimerManager_TimeOutEvent(object sender, EventArgs e)
|
||
|
{
|
||
|
TimeManager.TimeOutEvent -= TimerManager_TimeOutEvent;
|
||
|
OKSubmit();
|
||
|
}
|
||
|
|
||
|
//void Update()
|
||
|
//{
|
||
|
// if (TimeManager.RemainSeconds > TimeManager.TipTime)
|
||
|
// {
|
||
|
// TimeManager.RemainSeconds -= Time.deltaTime;
|
||
|
// ShowTimeAccordingSeconds((int)TimeManager.RemainSeconds);
|
||
|
// }
|
||
|
// else//考试时间结束,自动交卷
|
||
|
// {
|
||
|
// OKSubmit();
|
||
|
// }
|
||
|
//}
|
||
|
|
||
|
//void ShowTimeAccordingSeconds(int second)
|
||
|
//{
|
||
|
// var hour = second / 3600;
|
||
|
// var min = (second % 3600) / 60;
|
||
|
// var sec = (second % 3600) % 60;
|
||
|
// TimerWin.transform.FindChild("Time/Second").GetComponent<Text>().text = hour + ":" + min + ":" + sec;
|
||
|
//}
|
||
|
|
||
|
|
||
|
|
||
|
public void SubmitAnswerButton()
|
||
|
{
|
||
|
GameObject TipWindow = Instantiate(Resources.Load<GameObject>("UIPrefab/TipWindow"));
|
||
|
TipWindow.GetComponent<TipWindowManager>().SetWindow(
|
||
|
"确定提交?", new UnityEngine.Events.UnityAction(OKSubmit), new UnityEngine.Events.UnityAction(NOSubmit));
|
||
|
RecordManager.Instance.IsPause = true;//停止记录
|
||
|
}
|
||
|
public static void OKSubmit()
|
||
|
{
|
||
|
var question = BaseItemManager.CurQues;
|
||
|
var exam = BaseItemManager.CurExam;
|
||
|
AnswerInfo answer = new AnswerInfo();
|
||
|
answer.FilePath = exam.ID + "_" + question.ID + ".xml";//答案文件用考试ID+考题ID命名
|
||
|
answer.CreatorName = MySelf.mySelf.Name;
|
||
|
answer.CreatorID = MySelf.mySelf.ID;
|
||
|
answer.ExaminationID = exam.ID;
|
||
|
answer.QuestionID = question.ID;
|
||
|
answer.PaperID = exam.PaperID;
|
||
|
if (!BaseItemManager.AnswerList.Contains(answer))
|
||
|
{
|
||
|
BaseItemManager.AnswerList.Add(answer);//添加到待上传答案数组
|
||
|
}
|
||
|
//调用函数,创建答案xml文件;保存在对应考试ID下,避免多场考试引用同一考题,造成回答一个问题,所有考试考题都有答案
|
||
|
string filename_local = "Answers/" + answer.FilePath;//////////
|
||
|
RecordManager.Instance.SubmitAnswer(filename_local);//提交答案
|
||
|
//提交答案后,退出该场景,返回上一场景
|
||
|
MySceneManager.BackToLastScene();
|
||
|
}
|
||
|
private void NOSubmit()
|
||
|
{
|
||
|
Debug.Log("NOsubmit");
|
||
|
RecordManager.Instance.IsPause = false;//继续记录
|
||
|
}
|
||
|
}
|