Ejemplo n.º 1
0
        // This event handler method lauches a two player game when the button is clicked
        private void btnTwoP_Click(object sender, EventArgs e)
        {
            // Instantiate and display a new DiceWindow
            DiceWindow dwTwoPlayer = new DiceWindow();

            dwTwoPlayer.Show();

            // Minimise the menu button window
            WindowState = FormWindowState.Minimized;

            // Instantiate and display a name entry InputBox dialog for player one
            InputBox ibxP1Name = new InputBox(1);

            ibxP1Name.ShowDialog();

            // Instantiate and display a name entry InputBox dialog for player two
            InputBox ibxP2Name = new InputBox(2);

            ibxP2Name.ShowDialog();

            // Instantiate and display the game windows
            Player frmPlayer1 = new Player(ibxP1Name, dwTwoPlayer, 2);
            Player frmPlayer2 = new Player(ibxP2Name, dwTwoPlayer, 2);

            frmPlayer1.Show();
            frmPlayer2.Show();
        }
Ejemplo n.º 2
0
        // This event handler method lauches a one player game when the button is clicked
        private void btnSolo_Click(object sender, EventArgs e)
        {
            // Instantiate and display a new DiceWindow
            DiceWindow dwSolo = new DiceWindow();

            dwSolo.Show();

            // Minimise the menu button window
            WindowState = FormWindowState.Minimized;

            // Instantiate and display a name entry InputBox dialog
            InputBox ibxName = new InputBox(1);

            ibxName.ShowDialog();

            // Instantiate and display the game window
            Player frmPlayer = new Player(ibxName, dwSolo);

            frmPlayer.Show();
        }