Files
BH3/Assets/Scripts/Assembly-CSharp/MoleMole/WeatherInfoProvider_Wunderground.cs
2025-08-13 09:26:42 +08:00

26 lines
644 B
C#

using SimpleJSON;
namespace MoleMole
{
public class WeatherInfoProvider_Wunderground : WeatherInfoProvider
{
protected override string GetUrl()
{
return "http://api.wunderground.com/api/a48bebc6f61128cf/conditions/q/autoip.json";
}
protected override WeatherInfo ParseWeatherInfo(string content)
{
WeatherInfo weatherInfo = new WeatherInfo();
JSONNode jSONNode = JSONNode.Parse(content);
if (jSONNode != null)
{
weatherInfo.weatherType = WeatherType.Sunny;
weatherInfo.temperature = jSONNode["current_observation"]["temp_c"].AsFloat;
}
weatherInfo.extraInfo = content;
return weatherInfo;
}
}
}