12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System.Collections;
- using System.Collections.Generic;
- using LitJson;
- using UnityEngine;
- public class GongDanMainManager : MonoBehaviour
- {
- public ChuLiItemManager citem;
- public List<ChuLiItemManager> listitem=new List<ChuLiItemManager>();
-
- JsonData data;
- int indexex;
- public void initData(int i)
- {
- indexex=i;
- switch (indexex)
- {
- case 0:
- data = WindowMainManager.instance.DyData;
- break;
- case 1:
- data = WindowMainManager.instance.wwcData;
- break;
- case 2:
- data = WindowMainManager.instance.ywcData;
- break;
- }
- for (int j = 0;j<listitem.Count;j++)
- {
- Destroy(listitem[j].gameObject);
- }
- listitem.Clear();
- for (int j = 0;j< data["list"].Count;j++)
- {
- ChuLiItemManager item = GameObject.Instantiate(citem,citem.transform.parent);
- item.init( data["list"][j]);
- item.gameObject.SetActive(true);
- listitem.Add(item);
- }
- }
- public void init()
- {
- for (int j = 0;j<listitem.Count;j++)
- {
- Destroy(listitem[j].gameObject);
- }
- listitem.Clear();
-
- }
- void OnEnable()
- {
- Invoke("initdata",0.2f);
- }
- void initdata()
- {
- GongDanWindowManager.Instance.ttison();
- }
- }
|