Ejemplo n.º 1
0
        /// <summary>
        /// Initialises all of the dice labels for use in the game.
        /// </summary>
        private void InitialiseDice()
        {
            dice = new Die[NUMBER_OF_DICE];

            //get the die and set each label to one of the die.
            Label[] diceLabels = form.GetDice();
            for (int i = 0; i < NUMBER_OF_DICE; i++)
            {
                dice[i] = new Die(diceLabels[i]);
            }
        }
Ejemplo n.º 2
0
        }//end ContinueGame

        /// <summary>
        /// Link the labels on the GUI form to the dice and players
        /// </summary>
        /// <param name="form"></param>
        private void LoadLabels(Form1 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());
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// This method initialise all the instance variables of Game
 /// in preparation for a game to begin in the correct state
 /// </summary>
 /// <param name="formOneObject"></param>
 public Game(Form1 formOneObject)
 {
     form      = formOneObject;
     dieLabels = form.GetDice();
     players   = new BindingList <Player>();
     players.Add(new Player("Player 1", form.GetScoresTotals()));
     for (int index = 0; index < 5; index++)
     {
         dice[index] = new Die(dieLabels[index]);
     }
     numRolls = 1;
 }//end Game
Ejemplo n.º 4
0
        private void initialize()
        {
            dieLabels = form.GetDice();
            for (int i = 0; i < dice.Length; i++)
            {
                dice[i] = new Die(dieLabels[i]);
            }

            //for (int i = 0; i < testNames.Length; i++)
            //{
            //    players.Add(new Player(testNames[i], scoreLabels));
            //}
        }
Ejemplo n.º 5
0
        public Game(Form1 form)
        {
            players            = new BindingList <Player>();
            currentPlayerIndex = 0;
            playersFinished    = 0;
            numRolls           = 0;
            playersFinished    = 0;
            this.form          = form;

            dice      = new Die[NUMBER_OF_DICE];
            dieLabels = form.GetDice();
            for (int i = 0; i < NUMBER_OF_DICE; i++)
            {
                dice[i] = new Die(dieLabels[i]);
            }

            faceValues = new int[] { 0, 0, 0, 0, 0 };
        }
Ejemplo n.º 6
0
        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