Ejemplo n.º 1
0
        public void LoadLocation(GOLocation location)
        {
            inputField.text = location.addressString;
            addressMenu.SetActive(false);
            LocationManager locationManager = (LocationManager)goMap.locationManager;

            locationManager.SetLocation(location.coordinates);
        }
Ejemplo n.º 2
0
        public void LoadChoices(IList features)
        {
            while (addressMenu.transform.childCount > 1)
            {
                foreach (Transform child in addressMenu.transform)
                {
                    if (!child.gameObject.Equals(addressTemplate))
                    {
                        DestroyImmediate(child.gameObject);
                    }
                }
            }


            for (int i = 0; i < Math.Min(features.Count, 5); i++)
            {
                IDictionary feature = (IDictionary)features [i];

                IDictionary geometry    = (IDictionary)feature["geometry"];
                IList       coordinates = (IList)geometry["coordinates"];
                GOLocation  location    = new GOLocation();
                IDictionary properties  = (IDictionary)feature ["properties"];
                Coordinates coords      = new Coordinates(Convert.ToDouble(coordinates [1]), Convert.ToDouble(coordinates [0]), 0);

                if (goMap.mapType == GOMap.GOMapType.Mapzen_Legacy)
                {
                    location.addressString = (string)properties ["label"];
                }
                else
                {
                    location.addressString = (string)feature ["place_name"];
                }
                location.coordinates = coords;
                location.properties  = properties;

                GameObject cell = Instantiate(addressTemplate);
                cell.transform.SetParent(addressMenu.transform);
                cell.transform.GetComponentInChildren <Text> ().text = location.addressString;
                cell.name = location.addressString;
                cell.SetActive(true);

                Button btn = cell.GetComponent <Button> ();
                btn.onClick.AddListener(() => { LoadLocation(location); });
            }


            addressMenu.SetActive(true);
        }