43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
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<Collider>())
|
|
gameObject.AddComponent<MeshCollider>();
|
|
OnSetStationInfo();
|
|
}
|
|
|
|
public async void OnSetStationInfo()
|
|
{
|
|
sts = await DataController.Instance.GetProvincialLevelStationInfo(distCode,cityName);
|
|
if (sts != null)
|
|
{
|
|
transform.GetChild(0).GetComponent<AggregateStation>().SetInfo(sts.agentCons);
|
|
transform.GetChild(1).GetComponent<AggregateStation>().SetInfo(sts.energyStation);
|
|
transform.GetChild(2).GetComponent<AggregateStation>().SetInfo(sts.phoStation);
|
|
transform.GetChild(3).GetComponent<AggregateStation>().SetInfo(sts.microGrid);
|
|
transform.GetChild(4).GetComponent<AggregateStation>().SetInfo(sts.airCondition);
|
|
transform.GetChild(5).GetComponent<AggregateStation>().SetInfo(sts.windStation);
|
|
}
|
|
else
|
|
{
|
|
for (int i = 0; i < transform.childCount; i++)
|
|
{
|
|
transform.GetChild(i).gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|