예제 #1
0
파일: Game.cs 프로젝트: loumor/Yahtzee-
        /// <summary>
        /// Creates a new game and initiates the GUI desgin and starting buttons.
        /// </summary>
        /// <param name="form"></param>
        public Game(Form1 form)
        {
            form.clearScoreLabels();
            players.ResetBindings();
            players.Add(new Player(Names[0], form.GetScoreTotals()));

            string message = "Please Select the Number of Players";

            currentPlayerindex = 0;
            playersFinished    = 0;
            numRolls           = 0;

            this.form      = form;
            this.dieLabels = this.form.GetDice();

            for (int i = 0; i < dice.Length; i++)
            {
                dice[i] = new Die(dieLabels[i]);
            }
            currentPlayer = players[currentPlayerindex];


            for (int i = 0; i < dice.Length; i++)
            {
                dieLabels[i].Text = "";
            }

            string name = Names[currentPlayerindex];

            form.DisableAndClearCheckBoxes();
            form.DisableAllButtons();
            form.ShowPlayerName(name);
            form.EnableUpDown();
            form.EnableRollButtons();
            form.ShowMessage(message);
            form.HideOKButton();
            form.enablesave();
            form.disableload();
        }