private void timer1_Tick(object sender, EventArgs e)
 {
     if (time_count == 10)
     {
         time_count = 0;
         timer1.Stop();
         if (Pig_Double_Die_Game.PlayGame() == true)
         {
             MessageBox.Show("Sorry you have thrown a 1\n Your turn is over!\n");
             if (Pig_Double_Die_Game.current_player == "Player 1")
             {
                 Whose_Turn_to_label.Text             = "Player 2 Roll Die";
                 Pig_Double_Die_Game.current_player   = "Player 2";
                 Pig_Double_Die_Game.current_dice_sum = 0;
             }
             else
             {
                 Whose_Turn_to_label.Text             = "Player 1 Roll Die";
                 Pig_Double_Die_Game.current_player   = "Player 1";
                 Pig_Double_Die_Game.current_dice_sum = 0;
             }
         }
         else
         {
         }
     }
     else
     {
         time_count++;
         pictureBox1.Image = Games.Images.GetDieImage(Pig_Double_Die_Game.GetFaceValue()[0]);
         pictureBox2.Image = Games.Images.GetDieImage(Pig_Double_Die_Game.GetFaceValue()[1]);
     }
 }
Ejemplo n.º 2
0
 //Display the dice images
 private void renderImage()
 {
     PictureBox[] pictureBoxes = new PictureBox[2] {
         pigPictureBox, pigPictureBox2
     };
     for (int i = 0; i < dice.Length; i++)
     {
         pictureBoxes[i].Image    = Images.GetDieImage(Pig_Double_Die_Game.GetFaceValue(i));
         pictureBoxes[i].SizeMode = PictureBoxSizeMode.StretchImage;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Count the points a player has in real time.
 /// </summary>
 private void CountPoints()
 {
     for (int i = 0; i < dice.Length; i++)
     {
         if (pigLabelWhosTurnTo.Text == "Player 1")
         {
             playerOneTextBox.Text = (Int32.Parse(playerOneTextBox.Text) + Pig_Double_Die_Game.GetFaceValue(i) * POINT_MULTIPLIER).ToString();
         }
         else
         {
             playerTwoTextBox.Text = (Int32.Parse(playerTwoTextBox.Text) + Pig_Double_Die_Game.GetFaceValue(i) * POINT_MULTIPLIER).ToString();
         }
     }
 }