/// <summary> /// Constructor /// </summary> /// <param name="controller"></param> /// <param name="server_proxy"></param> public PilotStage(PilotController controller, ServerProxy server_proxy) { InitializeComponent(); _controller = controller; _server_proxy = server_proxy; _view_translator = new RadarViewTranslator( RadarContainer.Width / 2.0, RadarContainer.Height / 2.0, // radar screen canvas center x, y (RadarContainer.Width / 2.0) * 0.97 // radar canvas radial limit - use 97% of radius to allow for a little masking at the edges ); // radar limit in world coord (i.e. kilometers) // Use the view translate defaults for now. _pre_pilot_heading = _view_translator.RadarWorldHeading; _pre_pilot_visibility_range = _view_translator.RadarPilotVisibilityRange; _pre_pilot_radar_range = _view_translator.RadarWorldLimit; // Register handlers for Controller callbacks _controller.PropertyChanged += Controller_PropertyChangedHandler; _controller.AddedSprite += Controller_AddedSpriteHandler; _controller.TurnUpdateBegin += Controller_TurnUpdateBeginHandler; _controller.TurnUpdateEnd += Controller_TurnUpdateEndHandler; AttachServerHandlers(); }
/// <summary> /// Callback handler for when properties in the controller change. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Controller_PropertyChangedHandler(object sender, PropertyChangedEventArgs e) { PilotController controller = sender as PilotController; switch (e.PropertyName) { default: break; } }