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.
97 lines
2.7 KiB
97 lines
2.7 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.MessageSystem;
|
||
|
using System.Text.RegularExpressions;
|
||
|
using System;
|
||
|
using AX.NetworkSystem;
|
||
|
|
||
|
public class ExaminationPaperDetail : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
// Use this for initialization
|
||
|
public ExaminationPaperObject paper;
|
||
|
public InputField paperName;
|
||
|
public static List<string> questionId = new List<string>();
|
||
|
|
||
|
public Text questionCount;
|
||
|
void Start()
|
||
|
{
|
||
|
MessageDispatcher.AddListener("REFRESH_PAPER_UI", refreshUI);
|
||
|
}
|
||
|
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("REFRESH_PAPER_UI", refreshUI);
|
||
|
}
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public void submitExaminationPaper()
|
||
|
{
|
||
|
string detail = "";
|
||
|
var paperNameStr = paperName.text.Trim();
|
||
|
if (string.IsNullOrEmpty(paperNameStr))
|
||
|
{
|
||
|
detail += "试卷名称不能为空,";
|
||
|
}
|
||
|
if (questionId.Count == 0)
|
||
|
{
|
||
|
detail += "未选择试题,";
|
||
|
}
|
||
|
if (detail != "")
|
||
|
{
|
||
|
detail = detail.Substring(0, detail.Length - 1);
|
||
|
var obj = GameObject.Find("MessageBox").GetComponent<MessageTool>().showMessage(ShowMessageType.warning, "信息提示", detail);
|
||
|
transform.GetComponentInChildren<ParametersPanelClose>().TipWin = obj;
|
||
|
return;
|
||
|
}
|
||
|
paper.Name = paperNameStr;
|
||
|
paper.Questions = questionsToString();
|
||
|
paper.CreatorName = MySelf.mySelf.Name;
|
||
|
paper.CreatorID = MySelf.mySelf.ID;
|
||
|
paper.Pattern = (int)ExamInfoHelpClass.applicationMode;
|
||
|
NetworkManager.Default.SendRequestAsync("PAPER_SAVE_REQUEST", paper);
|
||
|
gameObject.SetActive(false);
|
||
|
}
|
||
|
private void refreshUI(IMessage message)
|
||
|
{
|
||
|
questionCount.text = questionId.Count.ToString();
|
||
|
}
|
||
|
public void showDetail(ExaminationPaperObject paper)
|
||
|
{
|
||
|
this.paper = paper;
|
||
|
paperName.text = paper.Name;
|
||
|
setQuestions(paper.Questions);
|
||
|
questionCount.text = questionId.Count.ToString();
|
||
|
}
|
||
|
|
||
|
private void setQuestions(string question)
|
||
|
{
|
||
|
if (!string.IsNullOrEmpty(question))
|
||
|
{
|
||
|
var questionStr = question.Split(',');
|
||
|
questionId = new List<string>(questionStr);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
questionId.Clear();
|
||
|
}
|
||
|
}
|
||
|
private string questionsToString()
|
||
|
{
|
||
|
string questionsStr = "";
|
||
|
if (questionId.Count > 0)
|
||
|
{
|
||
|
foreach (string question in questionId)
|
||
|
{
|
||
|
questionsStr += question + ",";
|
||
|
}
|
||
|
questionsStr = questionsStr.Substring(0, questionsStr.Length - 1);
|
||
|
}
|
||
|
return questionsStr;
|
||
|
}
|
||
|
}
|