}//end ContinueGame /// <summary> /// Link the labels on the GUI form to the dice and players /// </summary> /// <param name="form"></param> private void LoadLabels(Yahtzee form) { Label[] diceLabels = form.GetDice(); for (int i = 0; i < dice.Length; i++) { dice[i].Load(diceLabels[i]); } for (int i = 0; i < players.Count; i++) { players[i].Load(form.GetScoresTotals()); } }
/// <summary> /// Constructor for Game /// </summary> /// <param name="myForm"> Application form </param> public Game(Yahtzee myForm) { numPlayers = 2; form = myForm; currentPlayerIndex = 0; players = new BindingList <Player>(); for (int i = 0; i < numPlayers; i++) { players.Add(new Player("Player " + (i + 1), form.GetScoresTotals())); } currentPlayer = players[currentPlayerIndex]; dice = new Die[Num_Die]; dieLabels = form.GetDice(); for (int i = 0; i < Num_Die; i++) { dice[i] = new Die(dieLabels[i]); } playersFinished = 0; numRolls = 0; }