private void Start() { // Start search Chicago. OnlineMapsGoogleGeocoding query = OnlineMapsGoogleGeocoding.Find("Chicago"); // Specifies that search results should be sent to OnFindLocationComplete. query.OnComplete += OnFindLocationComplete; }
private void OnMapClick() { // Get the coordinates where the user clicked. Vector2 mouseCoords = OnlineMapsControlBase.instance.GetCoords(); // Try find location name by coordinates. OnlineMapsGoogleGeocoding query = OnlineMapsGoogleGeocoding.Find(mouseCoords); query.OnComplete += OnQueryComplete; }
private void FindLocation() { OnlineMapsGoogleGeocoding.Find(search).OnComplete += delegate(string s) { try { Vector2 position = OnlineMapsGoogleGeocoding.GetCoordinatesFromResult(s); if (position != Vector2.zero) { OnlineMaps.instance.position = position; } else { Debug.Log(s); } } catch { Debug.Log(s); } }; }
public void UpdateLocation(Vector2 point) { OnlineMapsGoogleGeocoding query = OnlineMapsGoogleGeocoding.Find(point); query.OnComplete += QueryComplete; }
private void OnGUI() { if (api == null) { api = OnlineMaps.instance; } int labelFontSize = GUI.skin.label.fontSize; int buttonFontSize = GUI.skin.button.fontSize; int toggleFontSize = GUI.skin.toggle.fontSize; int textFieldFontSize = GUI.skin.textField.fontSize; GUI.skin.label.fontSize = 20; GUI.skin.button.fontSize = 20; GUI.skin.toggle.fontSize = 20; GUI.skin.toggle.contentOffset = new Vector2(5, -5); GUI.skin.textField.fontSize = 20; if (GUI.Button(new Rect(5, 5, 50, 50), is2D ? "3D" : "2D") && !isCameraModeChange) { ChangeMode(); } if (rowStyle == null) { rowStyle = new GUIStyle(GUI.skin.button); RectOffset margin = rowStyle.margin; rowStyle.margin = new RectOffset(margin.left, margin.right, 1, 1); } if (activeRowStyle == null) { activeRowStyle = new GUIStyle(GUI.skin.button); activeRowStyle.normal.background = activeRowStyle.hover.background; RectOffset margin = activeRowStyle.margin; activeRowStyle.margin = new RectOffset(margin.left, margin.right, 1, 1); } if (GUI.Button(new Rect(5, 60, 50, 50), "+")) { api.zoom++; } Color defBackgroundColor = GUI.backgroundColor; for (int i = OnlineMaps.MAXZOOM; i > 2; i--) { if (api.zoom == i) { GUI.backgroundColor = Color.green; } if (GUI.Button(new Rect(5, 115 + (OnlineMaps.MAXZOOM - i) * 15, 50, 10), "")) { api.zoom = i; } GUI.backgroundColor = defBackgroundColor; } if (GUI.Button(new Rect(5, 390, 50, 50), "-")) { api.zoom--; } GUI.Box(new Rect(65, 5, Screen.width - 70, 75), ""); GUI.Label(new Rect(75, 10, 150, 50), "Find place:"); search = GUI.TextField(new Rect(200, 10, Screen.width - 320, 30), search); if (Event.current.type == EventType.KeyUp && (Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return)) { OnlineMapsGoogleGeocoding.Find(search).OnComplete += OnFindLocationComplete; } if (GUI.Button(new Rect(Screen.width - 110, 10, 100, 30), "Search")) { OnlineMapsGoogleGeocoding.Find(search).OnComplete += OnFindLocationComplete; } GUI.Label(new Rect(75, 45, 100, 30), "Show:"); api.labels = GUI.Toggle(new Rect(200, 50, 100, 30), api.labels, "Labels"); api.traffic = GUI.Toggle(new Rect(300, 50, 100, 30), api.traffic, "Traffic"); control.useElevation = !is2D && GUI.Toggle(new Rect(400, 50, 110, 30), control.useElevation, "Elevation"); GUI.skin.label.fontSize = labelFontSize; GUI.skin.button.fontSize = buttonFontSize; GUI.skin.toggle.fontSize = toggleFontSize; GUI.skin.toggle.contentOffset = Vector2.zero; GUI.skin.textField.fontSize = textFieldFontSize; }