ShanDongVirtualPowerPlant/u3d-ShanDongVirtualPowerPlant/Assets/Adam/Scripts/Components/CityInfo.cs

40 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CityInfo : MonoBehaviour
{
public string distCode;
public string cityName;
private void Start()
{
OnSetStationInfo();
}
public void OnSetStationInfo()
{
ScreenTopStatistics sts = DataController.Instance.GetStationsByDistCode(distCode);
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);
}
}
}
}