Esempio n. 1
0
        private void HideLocalSettlementButtons(SettlementButtonControl control)
        {
            control.Visibility = Visibility.Hidden;
            var neighbouringLocations = this.controllerViewModel.GetNeighbouringLocationsFrom(control.Location);

            foreach (var neighbouringLocation in neighbouringLocations)
            {
                this.settlementButtonControls[neighbouringLocation].Visibility = Visibility.Hidden;
            }
        }
Esempio n. 2
0
        private SettlementButtonControl PlaceSettlementButton(double x, double y, uint id, string toolTip)
        {
            var control = new SettlementButtonControl(id, x, y, this.SettlementSelectedEventHandler);

            control.ToolTip = toolTip;
            this.SettlementSelectionLayer.Children.Add(control);
            Canvas.SetLeft(control, x);
            Canvas.SetTop(control, y);

            return(control);
        }
Esempio n. 3
0
        private void SettlementSelectedEventHandler(SettlementButtonControl settlementButtonControl)
        {
            this.controllerViewModel.InitialSettlementLocation = settlementButtonControl.Location;
            this.controllerViewModel.ShowSettlementSelection   = false;

            // Turn off the controls for the location and its neighbours
            this.HideLocalSettlementButtons(settlementButtonControl);

            this.PlaceBuilding(settlementButtonControl.X, settlementButtonControl.Y, string.Empty, @"..\resources\settlements\blue_settlement.png", this.SettlementLayer);

            // Turn on the possible road controls for the location
            var roadEndLocations = this.controllerViewModel.GetValidConnectedLocationsFrom(settlementButtonControl.Location);

            for (var index = 0; index < roadEndLocations.Length; index++)
            {
                var id = string.Format("{0}-{1}", settlementButtonControl.Location, roadEndLocations[index]);
                var roadButtonControl = this.roadButtonControls[id];
                roadButtonControl.Visibility = Visibility.Visible;
                this.visibleRoadButtonControls.Add(roadButtonControl);
            }

            this.RoadSelectionLayer.Visibility = Visibility.Visible;
        }