using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityAsync; using WaitUntil = UnityAsync.WaitUntil; using System.Threading.Tasks; using UnityEngine.UI; public class GCZLLayer : MonoBehaviour { public GameObject classPrefab; public GameObject informationPrefab; public RectTransform classContent; public RectTransform informationContent; public YZTLayer zTLayer; public Sprite[] sprites; private List informations = new List(); private GameObject lastClassBtn; private int currentClass = -99; // Start is called before the first frame update async void Start() { await InitData(); StaticLod.instance.OnFoucusStatic(0); InitButton(); InitInformation(0); } void InitButton() { for (int i = 0; i < zTLayer.layerDatas.Length; i++) { string name = zTLayer.layerDatas[i].layerName; int temp = i; GameObject obj = Instantiate(classPrefab); obj.transform.SetParent(classContent); obj.GetComponentInChildren().text = name; obj.transform.localScale = Vector3.one; if (i == 0) { obj.GetComponent().sprite = sprites[0]; lastClassBtn = obj; } else { obj.GetComponent().sprite = sprites[1]; } obj.GetComponent