private void Start()
        {
            // Start search Chicago.
            OnlineMapsGoogleAPIQuery query = OnlineMapsFindLocation.Find("Chicago");

            // Specifies that search results should be sent to OnFindLocationComplete.
            query.OnComplete += OnFindLocationComplete;
        }
Beispiel #2
0
        private void OnMapClick()
        {
            // Get the coordinates where the user clicked.
            Vector2 mouseCoords = OnlineMapsControlBase.instance.GetCoords();

            // Try find location name by coordinates.
            OnlineMapsGoogleAPIQuery query = OnlineMapsFindLocation.Find(null, mouseCoords.y + "," + mouseCoords.x);

            query.OnComplete += OnQueryComplete;
        }
Beispiel #3
0
        private void Start()
        {
            // Gets Location Service Component.
//			OnlineMapsLocationService ls = OnlineMapsLocationService.instance;
//
//			if (ls == null)
//			{
//				Debug.LogError(
//					"Location Service not found.\nAdd Location Service Component (Component / Infinity Code / Online Maps / Plugins / Location Service).");
//				return;
//			}
//
//
//			ls.OnCompassChanged += OnCompassChanged;
            Debug.Log("find address " + homeAddress);
            OnlineMapsFindLocation.Find(homeAddress).OnComplete += OnFindLocationComlete;

            // Looking for a route between locations.
            // OnlineMapsFindDirection.Find(fromPlace, toPlace).OnComplete += OnComplete;
        }
Beispiel #4
0
 private void FindLocation()
 {
     OnlineMapsFindLocation.Find(search).OnComplete += delegate(string s)
     {
         try
         {
             Vector2 position = OnlineMapsFindLocation.GetCoordinatesFromResult(s);
             if (position != Vector2.zero)
             {
                 OnlineMaps.instance.position = position;
             }
             else
             {
                 Debug.Log(s);
             }
         }
         catch
         {
             Debug.Log(s);
         }
     };
 }
Beispiel #5
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 = 20; i > 2; i--)
            {
                if (api.zoom == i)
                {
                    GUI.backgroundColor = Color.green;
                }
                if (GUI.Button(new Rect(5, 115 + (20 - 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))
            {
                OnlineMapsFindLocation.Find(search).OnComplete += OnFindLocationComplete;
            }
            if (GUI.Button(new Rect(Screen.width - 110, 10, 100, 30), "Search"))
            {
                OnlineMapsFindLocation.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;
        }