Exemplo n.º 1
0
 void Start()
 {
     tileMap      = FindObjectOfType <Tilemap>();
     player       = FindObjectOfType <Player>();
     communicator = FindObjectOfType <Communicator>();
     mapIcons     = FindObjectOfType <MapIcons>();
 }
Exemplo n.º 2
0
        private async Task UpdateNearbyDrivers()
        {
            NearbyDrivers nearbyDrivers = null;

            try
            {
                nearbyDrivers = await _lyftPublicApi.GetNearbyDrivers(CenterPoint.Position.Latitude, CenterPoint.Position.Longitude);
            }
            catch (Exception e)
            {
                var dialog = new MessageDialog($"Error occured: {e.Message}");
                await dialog.ShowAsync();

                return;
            }

            if (nearbyDrivers.Drivers == null)
            {
                return;
            }

            var drivers = nearbyDrivers.Drivers
                          .Where(x => x.RideType == LyftRideType)
                          .SingleOrDefault();

            if (drivers == null)
            {
                return;
            }

            List <MapLyftIcon> icons = new List <MapLyftIcon>();

            foreach (var driver in drivers.Drivers)
            {
                var location = driver.Locations.FirstOrDefault();
                var mapIcon  = new MapLyftIcon()
                {
                    Location = new Geopoint(new BasicGeoposition()
                    {
                        Latitude  = location.lat,
                        Longitude = location.lng
                    }),
                    ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/LyftCarMap.png"))
                };

                icons.Add(mapIcon);
            }

            MapIcons.Clear();
            foreach (var icon in icons)
            {
                MapIcons.Add(icon);
            }
        }
Exemplo n.º 3
0
        private void AddMapIcon(Geopoint location, string title)
        {
            var mapIcon = new MapIcon()
            {
                Location = location,
                NormalizedAnchorPoint = new Point(0.5, 1.0),
                Title  = title.GetLocalized(),
                Image  = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/map.png")),
                ZIndex = 0
            };

            MapIcons.Add(mapIcon);
        }
Exemplo n.º 4
0
        private void DrawIcon(double longitude, double latitude, VesselType vt, Color iconColor, MapIcons.OtherIcon icon = MapIcons.OtherIcon.None)
        {
            var position = new Rect((float)(longitudeToPixels(longitude, latitude) - iconPixelSize / 2),
                                    (float)(latitudeToPixels(longitude, latitude) - iconPixelSize / 2),
                                    iconPixelSize, iconPixelSize);

            Rect shadow = position;

            shadow.x += iconShadowShift.x;
            shadow.y += iconShadowShift.y;

            iconMaterial.color = iconColorShadowValue;
            Graphics.DrawTexture(shadow, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial);

            iconMaterial.color = iconColor;
            Graphics.DrawTexture(position, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial);
        }
		private void DrawIcon(float xPos, float yPos, VesselType vt, Color iconColor, MapIcons.OtherIcon icon = MapIcons.OtherIcon.None)
		{
			var position = new Rect(xPos - iconPixelSize * 0.5f, yPos - iconPixelSize * 0.5f,
				               iconPixelSize, iconPixelSize);

			Rect shadow = position;
			shadow.x += iconShadowShift.x;
			shadow.y += iconShadowShift.y;

			iconMaterial.color = iconColorShadowValue;
			Graphics.DrawTexture(shadow, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial);

			iconMaterial.color = iconColor;
			Graphics.DrawTexture(position, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial);
		}