Exemple #1
0
        protected void LoadCurrentScores()
        {
            if (acesSaved == true)
            {
                acesScoreValue.Text      = aces.ToString();
                acesScoreValue.ForeColor = Color.Black;
                btnAces.Enabled          = false;
                btnAces.Visible          = false;
            }

            if (twosSaved == true)
            {
                twosScoreValue.Text      = twos.ToString();
                twosScoreValue.ForeColor = Color.Black;
                btnTwos.Enabled          = false;
                btnTwos.Visible          = false;
            }

            if (threesSaved == true)
            {
                threesScoreValue.Text      = threes.ToString();
                threesScoreValue.ForeColor = Color.Black;
                btnThrees.Enabled          = false;
                btnThrees.Visible          = false;
            }
            if (foursSaved == true)
            {
                foursScoreValue.Text      = fours.ToString();
                foursScoreValue.ForeColor = Color.Black;
                btnFours.Enabled          = false;
                btnFours.Visible          = false;
            }
            if (fivesSaved == true)
            {
                fivesScoreValue.Text      = fives.ToString();
                fivesScoreValue.ForeColor = Color.Black;
                btnFives.Enabled          = false;
                btnFives.Visible          = false;
            }
            if (sixesSaved == true)
            {
                sixesScoreValue.Text      = sixs.ToString();
                sixesScoreValue.ForeColor = Color.Black;
                btnSixes.Enabled          = false;
                btnSixes.Visible          = false;
            }

            if (threeOfaKindSaved == true)
            {
                ThreeofKindScoreValue.Text      = ThreeofKind.ToString();
                ThreeofKindScoreValue.ForeColor = Color.Black;
                btnThreeKind.Enabled            = false;
                btnThreeKind.Visible            = false;
            }

            if (fourOfAKindSaved == true)
            {
                FourofKindScoreValue.Text      = fours.ToString();
                FourofKindScoreValue.ForeColor = Color.Black;
                btnFourKind.Enabled            = false;
                btnFourKind.Visible            = false;
            }
            if (fullHouseSaved == true)
            {
                fullHouseScoreValue.Text      = FullHouse.ToString();
                fullHouseScoreValue.ForeColor = Color.Black;
                btnFullHouse.Enabled          = false;
                btnFullHouse.Visible          = false;
            }
            if (smallStraightSaved == true)
            {
                smallStraightScoreValue.Text      = SmallStraight.ToString();
                smallStraightScoreValue.ForeColor = Color.Black;
                btnSmallStraight.Enabled          = false;
                btnSmallStraight.Visible          = false;
            }
            if (largeStraightSaved == true)
            {
                largeStraightScoreValue.Text      = LargeStraight.ToString();
                largeStraightScoreValue.ForeColor = Color.Black;
                btnLargeStraight.Enabled          = false;
                btnLargeStraight.Visible          = false;
            }
            if (YahtzeeSaved == true)
            {
                YahtzeeScoreValue.Text      = Yahtzee.ToString();
                YahtzeeScoreValue.ForeColor = Color.Black;
                btnYahtzee.Enabled          = false;
                btnYahtzee.Visible          = false;
            }
            if (ChanceSaved == true)
            {
                chanceScoreValue.Text      = Chance.ToString();
                chanceScoreValue.ForeColor = Color.Black;
                btnChance.Enabled          = false;
                btnChance.Visible          = false;
            }

            if (YahtzeeBonus > 0)
            {
                yahtzeeBonusScoreValue.Text      = YahtzeeBonus.ToString();
                yahtzeeBonusScoreValue.ForeColor = Color.Black;
                btnYahtzeeBonus.Enabled          = false;
                btnYahtzeeBonus.Visible          = false;
            }

            //check if upper bonus achieved
            UpperBonusCalc();
            if (UpperBonus == 35)
            {
                upperBonusScoreValue.Text      = UpperBonus.ToString();
                upperBonusScoreValue.ForeColor = Color.Black;
            }

            TotalScoreCalc();
        }
Exemple #2
0
        protected void showPotentialLowerScore()
        {
            const int FULL_HOUSE     = 25;
            const int SMALL_STRAIGHT = 30;
            const int LARGE_STRAIGHT = 40;
            const int YAHTZEE        = 50;
            int       fieldValue     = 0;


            for (int i = 0; i < ytzDice.DiceArray.Length; i++)
            {
                TestDice.gameDice[i] = ytzDice.DiceArray[i].faceValue;
            }


            fieldValue = ytzDice.CalcFullHouse(TestDice.gameDice);
            System.Diagnostics.Debug.WriteLine(fieldValue.ToString());
            if (fullHouseSaved == false)
            {
                fullHouseScoreValue.Text      = FullHouse.ToString();
                fullHouseScoreValue.ForeColor = Color.Red;
                if (fieldValue > 0)
                {
                    fullHouseScoreValue.Text      = FULL_HOUSE.ToString();
                    fullHouseScoreValue.ForeColor = Color.Red;
                }
            }

            //small striaght check
            fieldValue = ytzDice.CalcStraight(false, TestDice.gameDice);
            System.Diagnostics.Debug.WriteLine(fieldValue.ToString());
            if (smallStraightSaved == false)
            {
                smallStraightScoreValue.Text      = SmallStraight.ToString();
                smallStraightScoreValue.ForeColor = Color.Red;

                if (fieldValue > 0)
                {
                    smallStraightScoreValue.Text      = SMALL_STRAIGHT.ToString();
                    smallStraightScoreValue.ForeColor = Color.Red;
                }
            }


            fieldValue = ytzDice.CalcStraight(true, TestDice.gameDice);
            System.Diagnostics.Debug.WriteLine(fieldValue.ToString());
            if (largeStraightSaved == false)
            {
                largeStraightScoreValue.Text      = LargeStraight.ToString();
                largeStraightScoreValue.ForeColor = Color.Red;

                if (fieldValue > 0)
                {
                    largeStraightScoreValue.Text      = LARGE_STRAIGHT.ToString();
                    largeStraightScoreValue.ForeColor = Color.Red;
                }
            }

            fieldValue = ytzDice.CalcXOfAKind(3, TestDice.gameDice);
            System.Diagnostics.Debug.WriteLine(fieldValue.ToString());
            if (threeOfaKindSaved == false)
            {
                ThreeofKindScoreValue.Text      = ThreeofKind.ToString();
                ThreeofKindScoreValue.ForeColor = Color.Red;
                if (fieldValue > 0)
                {
                    ThreeofKindScoreValue.Text      = fieldValue.ToString();
                    ThreeofKindScoreValue.ForeColor = Color.Red;
                }
            }

            fieldValue = ytzDice.CalcXOfAKind(4, TestDice.gameDice);
            System.Diagnostics.Debug.WriteLine(fieldValue.ToString());
            if (fourOfAKindSaved == false)
            {
                FourofKindScoreValue.Text      = FourofKind.ToString();
                FourofKindScoreValue.ForeColor = Color.Red;

                if (fieldValue > 0)
                {
                    FourofKindScoreValue.Text      = fieldValue.ToString();
                    FourofKindScoreValue.ForeColor = Color.Red;
                }
            }

            fieldValue = ytzDice.CalcXOfAKind(5, TestDice.gameDice);
            System.Diagnostics.Debug.WriteLine(fieldValue.ToString());
            if (YahtzeeSaved == false)
            {
                YahtzeeScoreValue.Text      = Yahtzee.ToString();
                YahtzeeScoreValue.ForeColor = Color.Red;
                if (fieldValue > 0)
                {
                    YahtzeeScoreValue.Text      = YAHTZEE.ToString();
                    YahtzeeScoreValue.ForeColor = Color.Red;
                }
            }


            fieldValue = ytzDice.CalcChance(TestDice.gameDice);
            System.Diagnostics.Debug.WriteLine(fieldValue.ToString());
            if (ChanceSaved == false)
            {
                chanceScoreValue.Text      = Chance.ToString();
                chanceScoreValue.ForeColor = Color.Red;
                if (fieldValue > 0)
                {
                    chanceScoreValue.Text      = fieldValue.ToString();
                    chanceScoreValue.ForeColor = Color.Red;
                }
            }
        }