Ejemplo n.º 1
0
 /// <summary>
 /// Reset the form for a new game.
 /// </summary>
 private void Reset()
 {
     playerOneTextBox.Text             = (0).ToString();
     playerTwoTextBox.Text             = (0).ToString();
     pigLabelWhosTurnTo.Text           = Pig_Single_Die_Game.GetNextPlayersName();
     yesAnotherGameRadioButton.Checked = false;
     anotherGameGroupBox.Enabled       = false;
     rollButton.Enabled = true;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Call the PlayGame function and determine the outcome of the round. Allow another turn if player did not roll a 1 or call the next player if player did roll a 1.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void rollButton_Click(object sender, EventArgs e)
        {
            int points = Pig_Single_Die_Game.GetPointsTotal(pigLabelWhosTurnTo.Text);

            if (!Pig_Single_Die_Game.PlayGame())
            {
                SetupRound();
                CountPoints();
            }
            else
            {
                SetupRound();
                UpdatePoints(points);
                Program.showOKMessageBox("Sorry, you've thrown a 1.\nYour turn is over.\nYour score reverts to " + points + ".");
                pigLabelWhosTurnTo.Text = Pig_Single_Die_Game.GetNextPlayersName();
            }

            if (Pig_Single_Die_Game.HasWon())
            {
                WonGame();
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// On player hold, continue the game as the next player.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void holdButton_Click(object sender, EventArgs e)
 {
     Pig_rollOrHoldLabel.Text = "Roll die";
     holdButton.Enabled       = false;
     pigLabelWhosTurnTo.Text  = Pig_Single_Die_Game.GetNextPlayersName();
 }
Ejemplo n.º 4
0
        } // end SetDieImage

        /// <summary>
        /// Switches between players - called after each turn
        /// </summary>
        private void SwitchPlayers()
        {
            lblWhoseTurn.Text = Pig_Single_Die_Game.GetNextPlayersName();

            SetRollMessage();
        }// end SwitchPlayers