}//END LoadLabels /// <summary> /// Checks the numericUpDown1 value after new game is started and adjusts the players based off this value after /// the rolldice button is pressed. /// </summary> private void CheckNumPlayers() { if (players.Count < form.NumberPlayers()) { for (int i = players.Count; i < form.NumberPlayers(); i++) { string name = "Player " + (i + 1); players.Add(new Player(name, form.GetScoresTotals())); } } else if (players.Count > form.NumberPlayers()) { for (int i = players.Count - 1; i >= form.NumberPlayers(); i--) { players.Remove(players[i]); } } }//END CheckNumPlayers
public Game(Form1 form1) { form = form1; playersFinished = 0; currentPlayerIndex = 0; players = new BindingList <Player>(); dieLabels = form.GetDice(); numRolls = 0; int numPlayers = form.NumberPlayers(); for (int i = 0; i < numPlayers; i++) { string name = "Player " + (i + 1); players.Add(new Player(name, form.GetScoresTotals())); } currentPlayer = players[currentPlayerIndex]; form.ShowPlayerName(currentPlayer.Name); form.ShowMessage(ROLLMESSAGES[numRolls]); for (int i = 0; i < dice.Length; i++) { dice[i] = new Die(dieLabels[i]); } }//END Game