Skip to content

Commit

Permalink
Fix for map API Request
Browse files Browse the repository at this point in the history
  • Loading branch information
bionicl committed May 21, 2019
1 parent d788b64 commit cf2dcc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Assets/MainScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -25699,7 +25699,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.0000021741748}
m_AnchoredPosition: {x: 0, y: 0.00000088978703}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1371052592
Expand Down Expand Up @@ -26384,7 +26384,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 134.06734, y: 60}
m_AnchoredPosition: {x: 275.22116, y: 60}
m_SizeDelta: {x: 0, y: 150}
m_Pivot: {x: 1, y: 1}
--- !u!114 &1433522477
Expand Down
8 changes: 6 additions & 2 deletions Assets/Scripts/GoogleMapDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,16 @@ string ReturnApiUrl(OneRequest request) {
Vector2 metersPos = Conversion.MetersToLatLon(new Vector2(tempPos.x, tempPos.y));
string output = "";
string retinaMultiplayer = "";
string positionX = metersPos.x.ToString();
positionX = positionX.Replace(',', '.');
string positionY = metersPos.y.ToString();
positionY = positionY.Replace(',', '.');
if (CheckUIScale.isRetina)
retinaMultiplayer = "@2x";
if (useGoogleMaps)
output = string.Format("http://maps.googleapis.com/maps/api/staticmap?center={0},{1}&zoom={2}&size=640x640&key={3}{4}", metersPos.x, metersPos.y, request.zoomLevel, GoogleLocationApi.instance.apiKey, style);
output = string.Format("http://maps.googleapis.com/maps/api/staticmap?center={0},{1}&zoom={2}&size=640x640&key={3}{4}", positionX, positionY, request.zoomLevel, GoogleLocationApi.instance.apiKey, style);
else
output = string.Format("https://api.mapbox.com/styles/v1/bionicl/cjbfocd42b59q2rqasdw3ezwb/static/{1},{0},{2},0,0/640x640{3}?access_token={4}&logo=false&attribution=false", metersPos.x, metersPos.y, request.zoomLevel-1, retinaMultiplayer, GoogleLocationApi.instance.mapBoxApiKey);
output = string.Format("https://api.mapbox.com/styles/v1/bionicl/cjbfocd42b59q2rqasdw3ezwb/static/{1},{0},{2},0,0/640x640{3}?access_token={4}&logo=false&attribution=false", positionX, positionY, request.zoomLevel-1, retinaMultiplayer, GoogleLocationApi.instance.mapBoxApiKey);
return output;
}
}

0 comments on commit cf2dcc2

Please sign in to comment.