25 lines
694 B
C#
Raw Normal View History

2021-04-14 15:02:33 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
2021-04-14 15:02:33 +08:00
using System.Text;
using System.Threading.Tasks;
using UnityEngine.Networking;
2021-04-14 15:02:33 +08:00
namespace Assets.Scripts.Apis
{
public class MapBoxApi: ApiBase
{
public async Task<string> GetAddressInfo(string address)
2021-04-14 15:02:33 +08:00
{
var url = $"https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/{ UnityWebRequest.EscapeURL(address) }.json?access_token={ App.MapBoxAccessToken }";
//var res = Get(url);
2021-04-14 15:02:33 +08:00
var result = await new HttpClient().GetAsync(url);
return await result.Content.ReadAsStringAsync();
//UnityWebRequest.
2021-04-14 15:02:33 +08:00
}
}
}