示例#1
0
 private void rollButton_Click(object sender, EventArgs e)
 {
     setScoreButtons(true);
     if (dice.RollCount <= 2)
     {
         dice.roll();
         for (int index = 0; index < 5; index++)
         {
             dicePictureBoxes[index].Image = dicePictures[dice[index] - 1];
         }
     }
     if (dice.RollCount == 3)
     {
         RollButton.Enabled = false;
     }
 }
示例#2
0
        private void rollButton_Click(object sender, EventArgs e)
        {
            dice.roll();

            var possibleScores = dice.getPossibleScores();

            if (button1.Enabled)
            {
                onesScoreLabel.Text = possibleScores.Ones.ToString();
            }
            if (button2.Enabled)
            {
                twosScoreLabel.Text = possibleScores.Twos.ToString();
            }
            if (button3.Enabled)
            {
                threesScoreLabel.Text = possibleScores.Threes.ToString();
            }
            if (button4.Enabled)
            {
                foursScoreLabel.Text = possibleScores.Fours.ToString();
            }
            if (button5.Enabled)
            {
                fivesScoreLabel.Text = possibleScores.Fives.ToString();
            }
            if (button6.Enabled)
            {
                sixesScoreLabel.Text = possibleScores.Sixes.ToString();
            }
            if (scoreThreeOfAKind.Enabled)
            {
                threeOfAKindLabel.Text = possibleScores.ThreeOfAKind.ToString();
            }
            if (scoreFourOfAKind.Enabled)
            {
                fourOfAKindLabel.Text = possibleScores.FourOfAKind.ToString();
            }
            if (scoreFullHouse.Enabled)
            {
                fullHouseLabel.Text = possibleScores.FullHouse.ToString();
            }
            if (scoreSmallStraight.Enabled)
            {
                smallStraightLabel.Text = possibleScores.SmallStraight.ToString();
            }
            if (scoreLargeStraight.Enabled)
            {
                largeStraightLabel.Text = possibleScores.LargeStraight.ToString();
            }
            if (scoreYahtzee.Enabled)
            {
                yahtzeeLabel.Text = possibleScores.Yahtzee.ToString();
            }
            if (scoreChance.Enabled)
            {
                chanceLabel.Text = possibleScores.Chance.ToString();
            }

            if (dice.RollCount == 3)
            {
                rollButton.Enabled = false;
            }
        }