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.
51 lines
1.6 KiB
51 lines
1.6 KiB
using UnityEngine; |
|
using System.Collections.Generic; |
|
using AX.MessageSystem; |
|
|
|
public class AllExamList : MonoBehaviour { |
|
|
|
public GameObject itemPrefab; |
|
public GameObject detail; |
|
public GameObject list; |
|
public List<ExaminationInfo> examList = new List<ExaminationInfo>(); |
|
void Start() |
|
{ |
|
MessageDispatcher.AddListener("SHOW_QUESTION_LIST", showList); |
|
MessageDispatcher.AddListener("GET_MARKING_EXAMINATION_INFOS_REFRESH", showExamList); |
|
} |
|
void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("SHOW_QUESTION_LIST", showList); |
|
MessageDispatcher.RemoveListener("GET_MARKING_EXAMINATION_INFOS_REFRESH", showExamList); |
|
} |
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
|
|
} |
|
|
|
//刷新列表信息 |
|
private void showExamList(IMessage message) |
|
{ |
|
PagingReplyInfo<ExaminationInfo> pair = (PagingReplyInfo<ExaminationInfo>)(message.Data); |
|
examList = pair.Items; |
|
foreach (Transform child in transform) |
|
{ |
|
Destroy(child.gameObject); |
|
} |
|
foreach (ExaminationInfo exam in examList) |
|
{ |
|
GameObject item = Instantiate(itemPrefab) as GameObject; |
|
item.transform.parent = transform; |
|
item.transform.localScale = new Vector3(1, 1, 1); |
|
item.name = "Item"; |
|
item.GetComponent<AllExamMessage>().setExam(exam); |
|
} |
|
} |
|
private void showList(IMessage message) |
|
{ |
|
ExaminationInfo exam = (ExaminationInfo)(message.Data); |
|
detail.SetActive(true); |
|
list.GetComponent<AllQuestionSelect>().showQuestionList(exam); |
|
} |
|
}
|
|
|