private void RoadSelectedEventHandler(RoadButtonControl roadButtonControl) { this.controllerViewModel.InitialRoadEndLocation = roadButtonControl.Start == this.controllerViewModel.InitialSettlementLocation ? roadButtonControl.End : roadButtonControl.Start; this.PlaceRoad(roadButtonControl, this.playerId); foreach (var visibleRoadButtonControl in this.visibleRoadButtonControls) { visibleRoadButtonControl.Visibility = Visibility.Hidden; } this.visibleRoadButtonControls.Clear(); this.RoadSelectionLayer.Visibility = Visibility.Hidden; if (!this.controllerViewModel.InGameSetup) { this.EndTurnButton.Visibility = Visibility.Visible; this.BuildActions.Visibility = Visibility.Hidden; this.controllerViewModel.BuildRoadSegment(roadButtonControl.Start, roadButtonControl.End); } else { this.ConfirmButton.Visibility = Visibility.Visible; } }
private void PlaceRoad(RoadButtonControl control, Guid playerId) { var roadImagePath = this.roadImagesByPlayerId[playerId][(int)control.RoadImageType]; control.Visibility = Visibility.Hidden; this.PlaceRoadControl(control.X, control.Y, roadImagePath); }
private RoadButtonControl PlaceRoadButton(uint start, uint end, double x, double y, string imagePath, RoadButtonControl.RoadImageTypes roadImageType) { var control = new RoadButtonControl(start, end, x, y, imagePath, roadImageType, this.RoadSelectedEventHandler); this.RoadSelectionLayer.Children.Add(control); Canvas.SetLeft(control, x); Canvas.SetTop(control, y); return(control); }