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.
42 lines
1.4 KiB
42 lines
1.4 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections.Generic;
|
||
|
using AX.MessageSystem;
|
||
|
|
||
|
public class ExaminationQuestionList : MonoBehaviour {
|
||
|
|
||
|
// Use this for initialization
|
||
|
public GameObject itemPrefab;
|
||
|
public List<ExaminationQuestionObject> questionList = new List<ExaminationQuestionObject>();
|
||
|
void Start ()
|
||
|
{
|
||
|
ExamInfoHelpClass.loadSceneMode = ExamInfoHelpClass.LoadSceneMode.CreatQuestion;
|
||
|
MessageDispatcher.AddListener("QUESTION_PAGE_REFRESH", showQuestionList);
|
||
|
}
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("QUESTION_PAGE_REFRESH", showQuestionList);
|
||
|
}
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
|
||
|
}
|
||
|
//刷新列表信息
|
||
|
private void showQuestionList(IMessage message)
|
||
|
{
|
||
|
PagingReplyInfo<ExaminationQuestionObject> pair = (PagingReplyInfo<ExaminationQuestionObject>)(message.Data);
|
||
|
questionList = pair.Items;
|
||
|
foreach (Transform child in this.transform)
|
||
|
{
|
||
|
Destroy(child.gameObject);
|
||
|
}
|
||
|
foreach (ExaminationQuestionObject 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<ExaminationQuestionMessage>().setQuestion(question);
|
||
|
}
|
||
|
}
|
||
|
}
|