using System.Collections; using System.Collections.Generic; using UnityEngine; public class CityInfo : MonoBehaviour { public string distCode; public string cityName; public ScreenTopStatistics sts = new ScreenTopStatistics(); private void Start() { if (!GetComponent()) gameObject.AddComponent(); OnSetStationInfo(); } public async void OnSetStationInfo() { sts = await DataController.Instance.GetProvincialLevelStationInfo(distCode,cityName); if (sts != null) { transform.GetChild(0).GetComponent().SetInfo(sts.agentCons); transform.GetChild(1).GetComponent().SetInfo(sts.energyStation); transform.GetChild(2).GetComponent().SetInfo(sts.phoStation); transform.GetChild(3).GetComponent().SetInfo(sts.microGrid); transform.GetChild(4).GetComponent().SetInfo(sts.airCondition); transform.GetChild(5).GetComponent().SetInfo(sts.windStation); } else { for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(false); } } } }