ShanDongVirtualPowerPlant/u3d-ShanDongVirtualPowerPlant/Assets/Adam/Scripts/DataController.cs

26 lines
988 B
C#

using Cysharp.Threading.Tasks;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DataController : MonoSingleton<DataController>
{
public string distCode;
// Start is called before the first frame update
public async UniTask<ScreenTopStatistics> GetProvincialLevelStationInfo(string _distCode, string _disName)
{
await UniTask.Delay(1000);
if (_distCode.Length == 4)
distCode = _distCode.Substring(0, 2);
if (_distCode.Length == 6)
distCode = _distCode.Substring(0, 4);
string url = Bootstrap.Instance.urlDic["µØÍ¼ÐÅÏ¢»ã×Ü"];
AreaStationData areaStationData = await AsyncWebReq.Get<AreaStationData>(url + distCode, Bootstrap.Instance.webAdapter.head, Bootstrap.Instance.webAdapter.token);
DataItem sts = areaStationData.data.Find(s => s.disName == _disName);
if (sts == null)
return null;
return sts.screenTopStatistics;
}
}