private void Start() { // Makes a request to Google Places API. OnlineMapsGooglePlaces.FindNearby( apiKey, new OnlineMapsGooglePlaces.NearbyParams( 151.1957362f, // Longitude -33.8670522f, // Latitude 5000) // Radius { types = "food" }).OnComplete += OnComplete; }
private void Start() { // Makes a request to Google Places API. OnlineMapsGooglePlaces.FindNearby( apiKey, new OnlineMapsGooglePlaces.NearbyParams( 114.407900232356f, // Longitude 30.5149806899667f, // Latitude 5000) // Radius { types = "food" }).OnComplete += OnComplete; }
/// <summary> /// This method is called when a response is received. /// </summary> /// <param name="s">Response string</param> private void OnComplete(string s) { // Trying to get an array of results. OnlineMapsGooglePlacesResult[] results = OnlineMapsGooglePlaces.GetResults(s); // If there is no result if (results == null) { Debug.Log("Error"); Debug.Log(s); return; } List <OnlineMapsMarker> markers = new List <OnlineMapsMarker>(); foreach (OnlineMapsGooglePlacesResult result in results) { // Log name and location of each result. Debug.Log(result.name); Debug.Log(result.location); // Create a marker at the location of the result. OnlineMapsMarker marker = OnlineMaps.instance.AddMarker(result.location, result.name); markers.Add(marker); } // Get center point and best zoom for markers Vector2 center; int zoom; OnlineMapsUtils.GetCenterPointAndZoom(markers.ToArray(), out center, out zoom); // Set map position and zoom. OnlineMaps.instance.position = center; OnlineMaps.instance.zoom = zoom + 1; }
public new static OnlineMapsFindPlacesResult[] GetResults(string response, out string nextPageToken) { OnlineMapsGooglePlacesResult[] results = OnlineMapsGooglePlaces.GetResults(response, out nextPageToken); return(OnlineMapsUtils.DeepCopy <OnlineMapsFindPlacesResult[]>(results)); }