Beispiel #1
0
        private void StartButton_OnClick(object sender, RoutedEventArgs e)
        {
            _controller.BeginTurn();
            var selectedDice =
                _controller.SelectedPlayer.Dice.Find(d => d.Number.ToString() == DiceComboBox.SelectedValue.ToString());

            _controller.SelectedPlayer.SelectedDice = selectedDice;

            DiceUsedText.Text  = selectedDice.IsUsed.ToString();
            DiceValueText.Text = selectedDice.Value.ToString();
        }
Beispiel #2
0
        private void InitializeGame()
        {
            _stateController = new StateController();
            _controller      = StateController.Instance;
            MakeLocations();
            Player player = new Player();

            _controller.Players.Add(player);
            _controller.SelectedPlayer = _controller.Players[0];
            _controller.BeginTurn();

            var diceList = _controller.SelectedPlayer.Dice.ConvertAll(d => d.Number.ToString());

            DiceComboBox.ItemsSource  = diceList;
            DiceComboBox.SelectedItem = diceList[0];
            _controller.SelectedPlayer.SelectedDice = _controller.SelectedPlayer.Dice
                                                      .Find(d => d.Number == int.Parse(DiceComboBox.SelectedValue.ToString()));

            var survivorList = _controller.Players[0].Survivors.ConvertAll(s => s.Name);

            SurvivorComboBox.ItemsSource  = survivorList;
            SurvivorComboBox.SelectedItem = survivorList[0];
            _controller.SelectedPlayer.SelectedSurvivor = _controller.SelectedPlayer.Survivors
                                                          .Find(s => s.Name == SurvivorComboBox.SelectedValue.ToString());

            var locationList = _controller.Locations.ConvertAll(l => l.Name);

            LocationComboBox.ItemsSource  = locationList;
            LocationComboBox.SelectedItem = locationList[0];
            _controller.SelectedLocation  =
                _controller.Locations.Find(l => l.Name == LocationComboBox.SelectedValue.ToString());
            var colony = (Colony)_controller.Locations.Find(l => l.GetType() == typeof(Colony));

            TrashText.Text = colony.AmountOfTrash.ToString();

            var hand = _controller.SelectedPlayer.Hand.Select(c => c.Name).ToList();

            HandComboBox.ItemsSource = hand;
        }