using LitJson; using UnityEngine; using UnityEngine.UI; using XFrame.Core.UI; using System.Collections.Generic; using System; public class ReplayPanel : XUIPanel { /// /// 生成列表 /// public List itemDatas = new List(); //private Boolean flag = false; public ReplayPanel() : base(UIType.Fixed, UIMode.None, UICollider.None) { uiPath = "Prefabs/ReplayPanel"; } public override void Awake(GameObject go) { //listContainer = this.gameObject.transform.Find("BG/TrainList/Viewport/Content/GameObject/TestPanel1"); //itemPrefab = Resources.Load("Prefabs/btn1") as GameObject; //TextAsset jsonFile = Resources.Load("testfile"); //string jsonString = jsonFile.text; //JsonData jsonData = JsonMapper.ToObject(jsonString); //Root data = JsonMapper.ToObject(jsonString); //InsanceItem(); //List subjectsInfoItems = data.subjectsInfo; switch (this.transform.Find("BG/TrainList/Viewport/Content/Dropdown").GetComponent().value) { case 0: ShowPanel(); break; default: break; } this.transform.Find("BG/TrainList/Viewport/Content/Dropdown").GetComponent().onValueChanged.AddListener((Int32) => { ShowPanel(); }); } //public GameObject itemPrefab; //public Transform listContainer; //public void InsanceItem() //{ // TextAsset jsonFile = Resources.Load("testfile"); // string jsonString = jsonFile.text; // JsonData jsonData = JsonMapper.ToObject(jsonString); // Root data = JsonMapper.ToObject(jsonString); // List subjectsInfoItems = data.subjectsInfo; // string text = null; // for (int i = 0; i < subjectsInfoItems.Count; i++) // { // GameObject newItem = GameObject.Instantiate(itemPrefab, listContainer); // // 获取生成的物体上的ItemData组件 // ItemData itemData = newItem.GetComponent(); // itemData.itemName = subjectsInfoItems[i].subjectName; // Button btn = newItem.GetComponent