protected string AnalysisResult(ExamPanelBase _examPanelBase) { string temp = ""; for (int i = 0; i < _examPanelBase.examPanelInfo.examOptionInfo.Count; i++) { if (_examPanelBase.examPanelInfo.examOptionInfo[i].isTrue) { temp += _examPanelBase.examPanelInfo.examOptionInfo[i].tag; } } return(temp); }
public void CreatTextExam(int examId) { ExamPanelBase examTemp = Instantiate(textTemplate); textExam.Add(examTemp); examTemp.examPanelInfo.id = examId; examTemp.transform.parent = textTemplate.transform.parent; examTemp.transform.localScale = new Vector3(1, 1, 1); List <string> option = ExamMgr.Instance.GetExam(examId).option; for (int j = 0; j < examTemp.transform.childCount; j++) { switch (examTemp.transform.GetChild(j).name) { case "题目": if (examTemp.transform.GetChild(j).GetComponent <Text>() != null) { textExam[textExam.Count - 1].examPanelInfo.topic = examTemp.transform.GetChild(j).GetComponent <Text>(); textExam[textExam.Count - 1].examPanelInfo.topic.gameObject.SetActive(true); textExam[textExam.Count - 1].examPanelInfo.topic.text = ExamMgr.Instance.GetExam(examId).examContent; } break; case "选项": if (examTemp.transform.GetChild(j).GetComponent <Toggle>() != null) { for (int m = 0; m < option.Count; m++) { Toggle optionTemp = Instantiate(examTemp.transform.GetChild(j)).GetComponent <Toggle>(); optionTemp.transform.parent = examTemp.transform; optionTemp.transform.localScale = new Vector3(1, 1, 1); optionTemp.gameObject.SetActive(true); optionTemp.GetComponentInChildren <Text>().text = option[m]; textExam[textExam.Count - 1].examPanelInfo.examOptionInfo.Add(new ExamOptionInfo(optionTemp, new System.Text.ASCIIEncoding().GetString(new byte[] { (byte)(m + 65) }))); } } break; case "解析": if (examTemp.transform.GetChild(j).GetComponent <Text>() != null) { textExam[textExam.Count - 1].examPanelInfo.analysis = examTemp.transform.GetChild(j).GetComponent <Text>(); textExam[textExam.Count - 1].examPanelInfo.analysis.transform.SetAsLastSibling(); textExam[textExam.Count - 1].examPanelInfo.analysis.gameObject.SetActive(true); } break; } } }