天津23维预案
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.
 
 
 
 
 
 

59 lines
1.7 KiB

using UnityEngine;
using System.Collections.Generic;
using UnityEngine.UI;
using AX.MessageSystem;
public class AllQuestionSelect : MonoBehaviour {
public GameObject itemPrefab;
public ExaminationInfo exam;
public static QuestionInfo question;//选中的题目
public GameObject scorePanel;
public GameObject list;
void Start()
{
//MessageDispatcher.AddListener("QUESTION_PAGE_REFRESH", showQuestionList);
}
void OnDestroy()
{
//MessageDispatcher.RemoveListener("QUESTION_PAGE_REFRESH", showQuestionList);
}
// Update is called once per frame
void Update()
{
}
public void showQuestionList(ExaminationInfo exam)
{
this.exam= exam;
var questionList = exam.QuestionInfos;
foreach (Transform child in this.transform)
{
Destroy(child.gameObject);
}
foreach (QuestionInfo question in questionList)
{
GameObject item = Instantiate(itemPrefab) as GameObject;
item.transform.parent = this.transform;
item.transform.localScale = new Vector3(1, 1, 1);
item.name = "Item";
item.GetComponent<AllQuestonSelectMessage>().setQuestion(question);
item.GetComponent<Toggle>().group = GetComponent<ToggleGroup>();
}
}
public void submitSelected()
{
var scoreList = exam.ScoreInfos;
var scores = new List<ScoreInfo>();
foreach (ScoreInfo score in scoreList)
{
if (score.QuestionID== question.ID)
{
scores.Add(score);
}
}
scorePanel.SetActive(true);
list.GetComponent<AllScoreList>().showScoreList(scores);
}
}