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(); }
private void NewRound() { this.RoundCount++; Debug.Log("Round: " + RoundCount.ToString()); foreach (Player p in this._players) { if (p == this.PlayerOnAttack) { p.NewTurn(true); } else { p.NewTurn(false); } } }
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(); }
private void CreatePlayers() { for (int i = 0; i < this._numberOfPlayers; i++) { GameObject temp = new GameObject("Player" + (i + 1).ToString()); var player = temp.AddComponent <Human>() as Human; player.Create(this._spawnPoints[i], (uint)i); player.roll = (uint)Random.Range(0, 100); Debug.Log(player.name + " Rolled: " + player.roll.ToString()); this._players.Add(player); } this._players.Sort((x1, x2) => x2.roll.CompareTo(x1.roll)); this._indexOnAttack = 0; this._indexInView = 0; this.PlayerOnAttack = this._players[0]; this.PlayerInView = this._players[0]; for (int i = 0; i < this._numberOfPlayers; i++) { this._players[i].Init((i == this._indexOnAttack) ? true : false); if (this.players[i] == this.PlayerOnAttack) { this.players[i].color = new Color(0.8823529f, 0.8823529f, 0.8823529f, 1.0f); } else { this.players[i].color = new Color(0.2352941f, 0.2352941f, 0.2352941f, 1.0f); } } this.RoundCount++; Debug.Log("Round: " + RoundCount.ToString()); }
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; } }