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.2 KiB
42 lines
1.2 KiB
using UnityEngine; |
|
using System.Collections.Generic; |
|
using AX.MessageSystem; |
|
|
|
public class ExaminationTeachLessonList : MonoBehaviour |
|
{ |
|
|
|
|
|
public GameObject itemPrefab; |
|
public List<CoursewareInfo> questionList = new List<CoursewareInfo>(); |
|
void Start() |
|
{ |
|
MessageDispatcher.AddListener("TEACHER_LESSON_REFRESH", showQuestionList); |
|
} |
|
void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("TEACHER_LESSON_REFRESH", showQuestionList); |
|
} |
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
|
|
} |
|
//刷新列表信息 |
|
private void showQuestionList(IMessage message) |
|
{ |
|
PagingReplyInfo<CoursewareInfo> pair = (PagingReplyInfo<CoursewareInfo>)(message.Data); |
|
questionList = pair.Items; |
|
foreach (Transform child in this.transform) |
|
{ |
|
Destroy(child.gameObject); |
|
} |
|
foreach (CoursewareInfo 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<ExaminationPrepareMessage>().setQuestion(question); |
|
} |
|
} |
|
} |