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.
130 lines
5.3 KiB
130 lines
5.3 KiB
using UnityEngine; |
|
using System.Collections; |
|
using System; |
|
using System.IO; |
|
using UnityEngine.UI; |
|
using AX.TrackRecord; |
|
using AX.MessageSystem; |
|
public class MakeScoreStudentQuestionItem : BaseSubItemManager |
|
{ |
|
private GameObject EditSaveBtn; |
|
private GameObject EditGiveUpBtn; |
|
private GameObject MakeScoreButton; |
|
public override void ButtonInit() |
|
{ |
|
this.gameObject.transform.Find("check").GetComponent<Button>().onClick.AddListener(CheckScore); |
|
this.gameObject.transform.Find("delete").GetComponent<Button>().onClick.AddListener(DeletScore); |
|
} |
|
void Start() |
|
{ |
|
EditSaveBtn = gameObject.transform.parent.parent.parent.parent.parent.transform.Find("EditSaveButton").gameObject; |
|
EditGiveUpBtn = gameObject.transform.parent.parent.parent.parent.parent.transform.Find("EditGiveUpButton").gameObject; |
|
MakeScoreButton = gameObject.transform.parent.parent.parent.parent.parent.transform.Find("MakeScoreButton").gameObject; |
|
CheckIfHasScore(); |
|
} |
|
public override void CheckIfHasAnswer() |
|
{ |
|
|
|
var flag = QuestionToggle.isOn; |
|
var PObj = transform.parent.parent.parent.parent.parent; |
|
//查看Scores文件下有没有此XML |
|
string path = ExamInfoHelpClass.CurrentWorkPath + "Scores/" + question.ID + ".xml"; |
|
bool Has=false; |
|
if (File.Exists(path)) |
|
{ |
|
Has = true; |
|
} |
|
if (Has) |
|
{ |
|
PObj.Find("MakeScoreButton").gameObject.SetActive(false); |
|
} |
|
else |
|
{ |
|
PObj.Find("MakeScoreButton").gameObject.SetActive(true); |
|
} |
|
EditSaveBtn.SetActive(false); |
|
EditGiveUpBtn.SetActive(false); |
|
} |
|
public void CheckIfHasScore() |
|
{ |
|
string path = ExamInfoHelpClass.CurrentWorkPath + "Scores/" + question.ID + ".xml"; |
|
if (File.Exists(path)) |
|
{ |
|
ShowBtn(true); |
|
} |
|
else |
|
{ |
|
ShowBtn(false); |
|
} |
|
} |
|
public void CheckScore()//查看评分 |
|
{ |
|
transform.parent.parent.parent.parent.parent.GetComponent<BaseItemManager>().Question = question; |
|
transform.parent.parent.parent.parent.parent.GetComponent<BaseItemManager>().CurSelectedTrans = transform; |
|
transform.parent.parent.parent.parent.parent.GetComponent<BaseItemManager>().CurSelectedTrans.GetComponent<BaseSubItemManager>().QuestionToggle.isOn = true; |
|
GameObject AddTagBtn = GameObject.Find("Canvas").transform.Find("AddTag").gameObject; |
|
string filename = "Scores/" + question.ID + ".xml"; |
|
AddTagBtn.SetActive(true); |
|
TheBackView.instance.EndBtn.SetActive(true); |
|
NodeSet.Instance.LoadRecordFromFile(filename); |
|
LoadManager.Instance.IsMakeScore = true; |
|
//MakeSorceSet.instance.stopped = false;//右下时间开始计时 |
|
EditSaveBtn.SetActive(true); |
|
EditGiveUpBtn.SetActive(true); |
|
MakeScoreButton.SetActive(false); |
|
MakeScoreButton.GetComponentInChildren<Text>().text = "打分"; |
|
CheckScoreBool = true; |
|
} |
|
public bool CheckScoreBool = false; |
|
|
|
public void DeletScore()//删除评分 |
|
{ |
|
if (GameObject.Find("Canvas").transform.Find("时间轴").gameObject.activeInHierarchy) |
|
{ |
|
MessageDispatcher.SendMessage("Operatinghints", (object)"回放中无法删除"); |
|
return; |
|
} |
|
GameObject TipWindow = Instantiate(Resources.Load<GameObject>("UIPrefab/TipWindow")); |
|
TipWindow.GetComponent<TipWindowManager>().SetWindow( |
|
"确定丢弃?", new UnityEngine.Events.UnityAction(OKDelect), new UnityEngine.Events.UnityAction(NoDelect)); |
|
} |
|
public void OKDelect() |
|
{ |
|
transform.parent.parent.parent.parent.parent.GetComponent<BaseItemManager>().Question = question; |
|
transform.parent.parent.parent.parent.parent.GetComponent<BaseItemManager>().CurSelectedTrans = transform; |
|
string path = ExamInfoHelpClass.CurrentWorkPath + "Scores/" + question.ID + ".xml"; |
|
string fileDir = Path.GetDirectoryName(path); |
|
string ThePath = question.ID + ".xml"; |
|
var PObj = transform.parent.parent.parent.parent.parent; |
|
if (Directory.Exists(fileDir)) |
|
{ |
|
string[] files = Directory.GetFiles(fileDir); |
|
foreach (string file in files) |
|
{ |
|
string str = Path.GetFileName(file); |
|
if (str.Equals(ThePath)) |
|
{ |
|
File.Delete(file); |
|
ShowBtn(false); |
|
if (transform.parent.parent.parent.parent.parent.GetComponent<BaseItemManager>().CurSelectedTrans.GetComponent<BaseSubItemManager>().QuestionToggle.isOn) |
|
{ |
|
PObj.Find("MakeScoreButton").gameObject.SetActive(true); |
|
PObj.Find("MakeScoreButton").GetComponentInChildren<Text>().text = "打分"; |
|
} |
|
} |
|
} |
|
} |
|
var list = MakeSorceSet.instance.ScoreList; |
|
var item = list.Find((s) => { return s.FilePath == (question.ID + ".xml"); });//Lambda |
|
list.Remove(item); |
|
} |
|
public void NoDelect() |
|
{ |
|
|
|
} |
|
public void ShowBtn(bool flag)//查看评分和删除评分按钮的显示和关闭 |
|
{ |
|
this.gameObject.transform.Find("check").gameObject.SetActive(flag); |
|
this.gameObject.transform.Find("delete").gameObject.SetActive(flag); |
|
} |
|
}
|
|
|