コード例 #1
0
		private void OnViewModelMapViewRequested(object sender, GameMapViewModel.MapViewRequestedEventArgs e)
		{
			// Updates the view according to the event.
			if (e.TargetBounds != null)
			{
				// Sets the map to show the target bounds.
				MapControl.SetView(e.TargetBounds);

				// If the bounds are too small, makes sure the surroundings are shown
				// to the player too.
				if (MapControl.ZoomLevel > GameMapViewModel.MAX_AUTO_ZOOM_LEVEL)
				{
					MapControl.ZoomLevel = GameMapViewModel.MAX_AUTO_ZOOM_LEVEL;
				}
			}
			else
			{
				// Sets the view using the target center and zoom level.
				MapControl.SetView(e.TargetCenter, e.TargetZoomLevel);
			}
		}
コード例 #2
0
 private void SetMapView(GameMapViewModel.MapViewRequestedEventArgs e)
 {
     // Updates the view according to the event.
     if (e.TargetBounds != null)
     {
         // Sets the map to show the target bounds.
         MapControl.SetView(e.TargetBounds, e.Animation);
     }
     else
     {
         // Sets the view using the target center and zoom level.
         MapControl.SetView(e.TargetCenter, e.TargetZoomLevel, e.Animation);
     }
 }
コード例 #3
0
 private void OnViewModelMapViewRequested(object sender, GameMapViewModel.MapViewRequestedEventArgs e)
 {
     if (_isMapReady)
     {
         SetMapView(e);
     }
     else
     {
         // Delays this request for after the map is ready.
         _delayedMapViewRequest = e;
     }
 }