protected void OnClickSave() { RoundCount++; RoundNumber.InnerText = RoundCount.ToString(); RollCount = 0; RollNumber.InnerText = RollCount.ToString(); btnRoll.Enabled = true; btnRoll.Visible = true; RollText.Text = ""; ClearSaveCheckboxes(); CheckBoxesEnable(); //unhide the checkboxes ClearScoreCard(); showPotentialUpperScore(); showPotentialLowerScore(); LoadCurrentScores(); }
protected void SetupNewGame() { ClearSaveCheckboxes(); SetupImages(); //SetDieImageSrc(); RollCount = 0; RoundCount = 1; RollNumber.InnerText = RollCount.ToString(); RoundNumber.InnerText = RoundCount.ToString(); btnRoll.Enabled = true; btnYahtzeeBonus.Visible = false; aces = 0; twos = 0; threes = 0; fours = 0; fives = 0; sixs = 0; FullHouse = 0; ThreeofKind = 0; FourofKind = 0; Yahtzee = 0; SmallStraight = 0; LargeStraight = 0; Chance = 0; UpperBonus = 0; YahtzeeBonus = 0; TotalScore = 0; acesSaved = false; twosSaved = false; threesSaved = false; foursSaved = false; fivesSaved = false; sixesSaved = false; fullHouseSaved = false; threeOfaKindSaved = false; fourOfAKindSaved = false; smallStraightSaved = false; largeStraightSaved = false; YahtzeeSaved = false; ChanceSaved = false; ClearScoreCard(); }
protected void btnRoll_Click(object sender, EventArgs e) { Random rnd = new Random(); int RollCheck = RollCount; switch (RollCheck) { case 0: ytzDice.RollDice(rnd); SetDieImageSrc(); //For the imd src url on page showPotentialUpperScore(); showPotentialLowerScore(); LoadCurrentScores(); RollCount = RollCount + 1; RollNumber.InnerText = RollCount.ToString(); break; case 1: HoldDice(); ytzDice.RollDice(rnd); SetDieImageSrc(); //For the imd src url on page showPotentialUpperScore(); showPotentialLowerScore(); YahtzeeBonuses(); LoadCurrentScores(); RollCount = RollCount + 1; RollNumber.InnerText = RollCount.ToString(); break; case 2: if (RoundCount == 13) { // Stop game functions and give final score btnRoll.Enabled = false; btnRoll.Visible = false; RollText.Text = "The Game has ended"; } else { HoldDice(); ytzDice.RollDice(rnd); SetDieImageSrc(); //For the imd src url on page showPotentialUpperScore(); showPotentialLowerScore(); YahtzeeBonuses(); LoadCurrentScores(); RollCount = RollCount + 1; RollNumber.InnerText = RollCount.ToString(); CheckBoxesDisable(); ClearSaveCheckboxes(); RollNumber.InnerText = RollCount.ToString(); RoundNumber.InnerText = RoundCount.ToString(); ResetBoxes(); } break; case 3: break; default: Console.WriteLine("We gotta problem here"); break; } }