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.
98 lines
3.8 KiB
98 lines
3.8 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using AX.MessageSystem;
|
||
|
using UnityEngine.UI;
|
||
|
using System;
|
||
|
using System.IO;
|
||
|
using AX.NetworkSystem;
|
||
|
|
||
|
public class ExaminationQuestionMessage : MonoBehaviour {
|
||
|
|
||
|
// Use this for initialization
|
||
|
public ExaminationQuestionObject question;
|
||
|
string filename;
|
||
|
void Start()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
|
||
|
}
|
||
|
public void setQuestion(ExaminationQuestionObject question)
|
||
|
{
|
||
|
this.question = question;
|
||
|
CheckIfHasFile();
|
||
|
//transform.FindChild("Icon").GetComponent<Image>().sou = question.sceneType.ToString();
|
||
|
transform.Find("SceneType").GetComponent<Text>().text = ((ExamInfoHelpClass.Scene)question.SceneType).ToString();
|
||
|
transform.Find("QuestionName").GetComponent<Text>().text = question.Name;
|
||
|
transform.Find("Creator").GetComponent<Text>().text = question.CreatorName;
|
||
|
transform.Find("CreateTime").GetComponent<Text>().text = question.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||
|
if (question.CreatorId != MySelf.mySelf.ID)
|
||
|
{
|
||
|
transform.Find("DetailButton").GetComponent<Button>().interactable = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void CheckIfHasFile()
|
||
|
{
|
||
|
filename = "Questions/" + question.ID + "/" + question.FilePath;
|
||
|
var filepath = ExamInfoHelpClass.CurrentWorkPath + filename;//文件完整路径
|
||
|
|
||
|
if (File.Exists(filepath))
|
||
|
{
|
||
|
transform.Find("DetailButton").gameObject.SetActive(true);
|
||
|
transform.Find("CopyButton").gameObject.SetActive(true);
|
||
|
transform.Find("DownloadButton").gameObject.SetActive(false);
|
||
|
var CircleProcessBar = transform.Find("CircleProcessBar").gameObject;
|
||
|
CircleProcessBar.SetActive(false);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
transform.Find("DetailButton").gameObject.SetActive(false);
|
||
|
transform.Find("CopyButton").gameObject.SetActive(false);
|
||
|
transform.Find("DownloadButton").gameObject.SetActive(true);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
public void DownloadButton()
|
||
|
{
|
||
|
var files = new string[] { filename };
|
||
|
transform.Find("DownloadButton").gameObject.SetActive(false);
|
||
|
var CircleProcessBar = transform.Find("CircleProcessBar").gameObject;
|
||
|
CircleProcessBar.SetActive(true);
|
||
|
CircleProcessBar.GetComponent<FileTransTipWinManager>().SetFileTrans("下载", files, TransferType.Download);
|
||
|
|
||
|
FileTransTipWinManager.task.TransferTaskCompleted += DownloadTaskCompleted;
|
||
|
}
|
||
|
|
||
|
private void DownloadTaskCompleted()
|
||
|
{
|
||
|
FileTransTipWinManager.task.TransferTaskCompleted -= DownloadTaskCompleted;
|
||
|
var CircleProcessBar = transform.Find("CircleProcessBar").gameObject;
|
||
|
CircleProcessBar.SetActive(false);
|
||
|
transform.Find("DetailButton").gameObject.SetActive(true);
|
||
|
transform.Find("CopyButton").gameObject.SetActive(true);
|
||
|
}
|
||
|
|
||
|
public void updateDetail()
|
||
|
{
|
||
|
ExamInfoHelpClass.loadSceneMode = ExamInfoHelpClass.LoadSceneMode.EditQuestion;
|
||
|
ExaminationQuestionDetail.question = question;
|
||
|
UIController.filename= question.ID + "/" + question.FilePath;
|
||
|
MySceneManager.MyLoadScene(question.SceneType.ToString());
|
||
|
}
|
||
|
public void CopyDetail()
|
||
|
{
|
||
|
var newQuestion = new ExaminationQuestionObject();
|
||
|
newQuestion.SceneType = question.SceneType;
|
||
|
newQuestion.Name = question.Name;
|
||
|
newQuestion.FilePath = question.FilePath;
|
||
|
newQuestion.Intro = question.Intro;
|
||
|
ExamInfoHelpClass.loadSceneMode = ExamInfoHelpClass.LoadSceneMode.CopyQuestion;
|
||
|
ExaminationQuestionDetail.question = newQuestion;
|
||
|
UIController.filename = question.ID + "/" + question.FilePath;
|
||
|
MySceneManager.MyLoadScene(question.SceneType.ToString());
|
||
|
}
|
||
|
}
|