Пример #1
0
 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);
         }
     };
 }
Пример #2
0
        public void Search()
        {
            if (!OnlineMapsKeyManager.hasGoogleMaps)
            {
                Debug.LogWarning("Please enter Map / Key Manager / Google Maps");
                return;
            }

            if (inputField == null)
            {
                return;
            }
            if (inputField.text.Length < 3)
            {
                return;
            }

            string locationName = inputField.text;

            OnlineMapsGoogleGeocoding request = new OnlineMapsGoogleGeocoding(locationName, OnlineMapsKeyManager.GoogleMaps());

            request.OnComplete += OnGeocodingComplete;
            request.Send();
        }
Пример #3
0
    public void UpdateLocation(Vector2 point)
    {
        OnlineMapsGoogleGeocoding query = OnlineMapsGoogleGeocoding.Find(point);

        query.OnComplete += QueryComplete;
    }
Пример #4
0
        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;
        }
Пример #5
0
 public new static OnlineMapsFindLocationResult[] GetResults(string response)
 {
     OnlineMapsGoogleGeocodingResult[] results = OnlineMapsGoogleGeocoding.GetResults(response);
     return(OnlineMapsUtils.DeepCopy <OnlineMapsFindLocationResult[]>(results));
 }