Пример #1
0
        private void BackToGameSelector_Click(object sender, RoutedEventArgs e)
        {
            GameSelector gs = new GameSelector(players);

            this.Hide();
            gs.Show();
        }
Пример #2
0
        private void backButton_Click(object sender, RoutedEventArgs e)
        {
            GameSelector gs = new GameSelector(players);

            this.Visibility = Visibility.Hidden;
            gs.Show();
        }
Пример #3
0
        /// <summary>
        /// Use the text 'from the UI's textboxes to fill in the list of players
        /// </summary>
        public void StartButton_Click(object sender, RoutedEventArgs e)
        {
            string p1 = playerName1.Text;
            string p2 = playerName2.Text;
            string p3 = playerName3.Text;
            string p4 = playerName4.Text;

            string[] playernames = new string[] { p1, p2, p3, p4 };

            if (playernames.All(playername => isInvalidName(playername)))
            {
                Player pl1 = new Player(p1);
                Player pl2 = new Player(p2);
                Player pl3 = new Player(p3);
                Player pl4 = new Player(p4);

                this.players.Add(pl1);
                this.players.Add(pl2);
                this.players.Add(pl3);
                this.players.Add(pl4);

                //Show the players participating and go to the gameselector screen
                MessageBox.Show($"Spelers {playerName1.Text}, {playerName2.Text}, {playerName3.Text}, {playerName4.Text} gaan een spel starten, Veel plezier!");
                GameSelector gs = new GameSelector(players);
                this.Visibility = Visibility.Hidden;
                gs.Show();
            }
            else
            {
                MessageBox.Show("Niet alle namen bevatten alleen letters of nummers!");
            }
        }
Пример #4
0
        public override void EndGame()
        {
            //Close the game.
            //TO DO: check if game closes and gameselector starts up again
            active = false;
            System.Windows.Forms.Application.Exit();
            GameSelector gs = new GameSelector(players);

            gs.Show();
        }
 public MensErgerJeNietUI(string gameName, List <Player> players)
 {
     this.gameSelector = new GameSelector(players);
     this.players      = players;
     InitializeComponent();
     //Player's names are set on the UI
     player1Field.Text = players[0].getPlayerName();
     player2Field.Text = players[1].getPlayerName();
     player3Field.Text = players[2].getPlayerName();
     player4Field.Text = players[3].getPlayerName();
 }