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.
89 lines
2.9 KiB
89 lines
2.9 KiB
using UnityEngine; |
|
using System.Collections; |
|
using AX.MessageSystem; |
|
using UnityEngine.UI; |
|
using System; |
|
using System.IO; |
|
using UnityEngine.SceneManagement; |
|
public class ExaminationPrepareMessage : MonoBehaviour |
|
{ |
|
|
|
// Use this for initialization |
|
public CoursewareInfo Courseware; |
|
void Start() |
|
{ |
|
GetComponent<Toggle>().onValueChanged.AddListener(ChangeValue); |
|
if(GetComponent<Toggle>().isOn) |
|
{ |
|
ControlCourse.instance.Course = Courseware; |
|
ControlCourse.instance.Item = this.gameObject; |
|
} |
|
} |
|
|
|
void OnDestroy() |
|
{ |
|
GetComponent<Toggle>().onValueChanged.RemoveListener(ChangeValue); |
|
} |
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
|
|
} |
|
public void setQuestion(CoursewareInfo Courseware) |
|
{ |
|
this.Courseware = Courseware; |
|
string str = ((ExamInfoHelpClass.Scene)Courseware.SceneType).ToString(); |
|
transform.Find("TouXiang").GetComponent<Image>().sprite = Resources.Load("TestSet/" + str, typeof(Sprite)) as Sprite; |
|
transform.Find("KeJianName/ShowKeJianName").GetComponent<Text>().text = Courseware.CreatorName; |
|
//transform.Find("Name/ShowName").GetComponent<Text>().text = Courseware.CreatorName; |
|
//transform.Find("Time/ShowTime").GetComponent<Text>().text = Courseware.CreateTime.ToShortDateString(); |
|
//CheckIfHasFiles(Courseware); |
|
} |
|
|
|
private void CheckIfHasFiles(CoursewareInfo courseware) |
|
{ |
|
var files = courseware.FilePath.Split(new char[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries); |
|
bool needDownload = false; |
|
for (int i = 0; i < files.Length; i++) |
|
{ |
|
var file = ExamInfoHelpClass.CurrentWorkPath + "Coursewares/" + courseware.ID + "/" + files[i]; |
|
if (!File.Exists(file)) |
|
{ |
|
needDownload = true; |
|
} |
|
} |
|
if (needDownload) |
|
{ |
|
transform.Find("Download/XiaZaiBtn").gameObject.SetActive(true); |
|
transform.Find("Download/CircleProcessBar").gameObject.SetActive(false); |
|
} |
|
else |
|
{ |
|
transform.Find("Download/XiaZaiBtn").gameObject.SetActive(false); |
|
transform.Find("Download/CircleProcessBar").gameObject.SetActive(true); |
|
transform.Find("Download/CircleProcessBar/process").GetComponent<Image>().fillAmount = 1; |
|
transform.Find("Download/CircleProcessBar/indicator").GetComponent<Text>().text = "100%"; |
|
} |
|
} |
|
|
|
public void updateDetail() |
|
{ |
|
|
|
} |
|
public void CopyDetail() |
|
{ |
|
var newQuestion = new CoursewareInfo(); |
|
newQuestion.SceneType = Courseware.SceneType; |
|
newQuestion.Name = Courseware.Name; |
|
newQuestion.FilePath = Courseware.FilePath; |
|
} |
|
public void ChangeValue(bool check) |
|
{ |
|
if (check) |
|
{ |
|
ControlCourse.instance.Course = Courseware; |
|
ControlCourse.instance.Item = this.gameObject; |
|
} |
|
} |
|
|
|
}
|
|
|