예제 #1
0
파일: Two_Up.cs 프로젝트: I3un/CAB201
        // a timer click will be implemented, where during the throw button, the coin will
        // siphon through either heads or tails until after a certain time, it will then land and choose
        // either heads or tails

        private void timer1_Tick(object sender, EventArgs e)
        {
            counter += 1;
            Two_Up_Game.TossCoin();
            UpdatePictureBoxImage(pictureBox1, Two_Up_Game.IsHeads(0));
            UpdatePictureBoxImage(pictureBox2, Two_Up_Game.IsHeads(1));
            label5.Visible      = true;
            label5.Text         = Two_Up_Game.TossOutcome();
            throwButton.Enabled = false;
            if (counter == 10)
            {
                timer1.Stop();
                if (Two_Up_Game.TossOutcome() == "Odd")
                {
                    throwButton.Enabled = true;
                }
                playernumberLabel.Text   = Convert.ToString(Two_Up_Game.GetPlayersScore());
                computernumberLabel.Text = Convert.ToString(Two_Up_Game.GetComputersScore());
            }
        }
예제 #2
0
        }// end UpdatePictureBoxImage

        /// <summary>
        /// Updates the pictureboxs
        /// </summary>
        private void UpdateImages()
        {
            UpdatePictureBoxImage(pictureBox1, Two_Up_Game.IsHeads(1));
            UpdatePictureBoxImage(pictureBox2, Two_Up_Game.IsHeads(2));
        }
        }//end Two_Up form constructor

        private void UpdateImage()
        {
            UpdatePictureBoxImage(pictureBox1, Two_Up_Game.IsHeads(1)); //updates picturebox1 with coin image
            UpdatePictureBoxImage(pictureBox2, Two_Up_Game.IsHeads(2)); //updates picturebox2 with coin image
        }//end UpdateImage