ShanxiKnowledgeBase/SXElectricalInspection/Assets/Adam/Scripts/ExitCheckController.cs

106 lines
3.4 KiB
C#

using Adam;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Utility;
public class ExitCheckController : MonoBehaviour
{
public GameObject ExitCheckPanel;
public GameObject End;
public Button QDButton;
public Button QXButton;
public Button closeButton;
public Text text_sub;
public int num_click;
//public string endTime;
// Start is called before the first frame update
void Start()
{
num_click = 0;
QDButton.onClick.AddListener(() =>
{
num_click++;
ResetPlane();
});
QXButton.onClick.AddListener(() =>
{
num_click = 0;
ExitCheckPanel.SetActive(false);
});
closeButton.onClick.AddListener(() =>
{
num_click = 0;
ExitCheckPanel.SetActive(false);
});
UIManager.Instance.timers.timeOver.AddListener((s) =>
{
num_click = 2;
//endTime = s;
ResetPlane();
});
}
public void ResetPlane()
{
switch (num_click)
{
case 0:
text_sub.text = "是否确认退出检查!!!";
break;
case 1:
text_sub.text = "结束检查后无法重回现场检查,是否确定。";
break;
case 2:
foreach (Toggle item in UIManager.Instance.bottomCotroller.toggles)
{
item.isOn = false;
item.gameObject.SetActive(false);
if (item.name == "异常记录")
{
item.gameObject.SetActive(true);
item.isOn = true;
}
}
WaitUpScore();
UIManager.Instance.bottomCotroller.updownLadder.gameObject.SetActive(false);
UIManager.Instance.overTaskBtn.gameObject.SetActive(false);
End.SetActive(true);
ExitCheckPanel.SetActive(false);
CurrentExamPaperDetails cepd = new CurrentExamPaperDetails();
cepd.userName = GlobalFlag.userName;
cepd.userId = GlobalFlag.userId;
cepd.examId = GlobalFlag.examId;
cepd.classId = GlobalFlag.classId;
cepd.useTime = UIManager.Instance.timers.GetCurrentTime();
cepd.examClassId = GlobalFlag.examinationRoom;
cepd.stepList = FractionManager.Instance.examPaperDetails;
string json = JsonConvert.SerializeObject(cepd);
string answerRecordUrl = WebIPAdress.Instance.dicAdresses["考试提交分数"];
Debug.Log(answerRecordUrl);
StartCoroutine(AsyncWebReq.PoststringByRaw(answerRecordUrl, json));
ToolUtility.WriteToLocal("AnswerRecord", cepd);
break;
}
}
private void WaitUpScore()
{
int jobCardScore = UIManager.Instance.jobCardController.AddScore();
List<string> stepPoint = UIManager.Instance.jobCardController.stepInfo;
FractionManager.Instance.CheckWriteOders(jobCardScore, stepPoint);
string abnormalRecord = UIManager.Instance.bottomCotroller.panels[2].GetComponentInChildren<TMP_InputField>().text;
Debug.Log(abnormalRecord);
FractionManager.Instance.CheckAbnormalRecords(abnormalRecord);
}
}