コード例 #1
0
ファイル: MainGameForm.cs プロジェクト: tay1392/Backgammon
 public void WaitingForDiceRoll()
 {
     InfoLabel.Text = Game.CurrentPerson.ToString() + " - Roll the dice";
     if (Game.CurrentPerson.IsAI)
     {
         DiceButton.Enabled = false;
         DiceTimer.Start();
     }
     else
     {
         DiceButton.Enabled = true;
     }
 }
コード例 #2
0
        }//end UpdatePictureBoxes

        /// <summary>
        /// increments counter, show rolling animation while counter is less than 11
        /// Stops timer, rolls dice and gets values, enables RollButton.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DiceTimer_Tick(object sender, EventArgs e)
        {
            counter++;

            if (counter < 11)
            {
                UpdatePictureBoxes();
            }
            else
            {
                DiceTimer.Stop();
                RollDice();
                RollButton.Enabled = true;
            }
        } //end DiceTimer
コード例 #3
0
 /// <summary>
 /// Disables RollButton, initializes counter as 0, starts DiceTimer.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void RollButton_Click(object sender, EventArgs e)
 {
     RollButton.Enabled = false;
     counter            = 0;
     DiceTimer.Start();
 }//end of RollButton
コード例 #4
0
ファイル: MainGameForm.cs プロジェクト: tay1392/Backgammon
 private void DiceTimer_Tick(object sender, EventArgs e)
 {
     DiceTimer.Stop();
     Game.Roll();
 }