Example #1
0
 private void fGame_KeyDown(object sender, KeyEventArgs e)
 {
     if (timer1.Enabled == true)
     {
         if (gamers[0] == false && e.KeyData == Keys.A)
         {
             GamePause();
             fMessage fm = new fMessage();
             fm.lGamer.Text = "Игрок 1";
             gamers[0]      = true;
             if (fm.ShowDialog() == DialogResult.Yes)
             {
                 labelGamer1.Text = Convert.ToString(Convert.ToInt32(labelGamer1.Text) + 1);
                 MakeMusic();
             }
             GamePlay();
         }
         if (gamers[1] == false && e.KeyData == Keys.P)
         {
             GamePause();
             fMessage fm = new fMessage();
             fm.lGamer.Text = "Игрок 2";
             gamers[1]      = true;
             if (fm.ShowDialog() == DialogResult.Yes)
             {
                 labelGamer2.Text = Convert.ToString(Convert.ToInt32(labelGamer2.Text) + 1);
                 MakeMusic();
             }
             GamePlay();
         }
     }
 }
Example #2
0
 private void fGame_KeyDown(object sender, KeyEventArgs e)
 {
     if (!timer1.Enabled)
     {
         return;
     }
     if (e.KeyData == Keys.Z)
     {
         if (players[0])
         {
             return;
         }
         players[0] = true;
         PauseGame();
         fMessage    fm  = new fMessage();
         SoundPlayer sp1 = new SoundPlayer("Resources\\1.wav");
         sp1.Play();
         fm.lblMessage.Text = "Player 1";
         if (fm.ShowDialog() == DialogResult.Yes)
         {
             lblScore1.Text = Convert.ToString(Convert.ToInt32(lblScore1.Text) + 1);
             return;
         }
         ResumeGame();
     }
     if (e.KeyData == Keys.P)
     {
         if (players[1])
         {
             return;
         }
         players[1] = true;
         PauseGame();
         fMessage    fm  = new fMessage();
         SoundPlayer sp2 = new SoundPlayer("Resources\\2.wav");
         sp2.Play();
         fm.lblMessage.Text = "Player 2";
         if (fm.ShowDialog() == DialogResult.Yes)
         {
             lblScore2.Text = Convert.ToString(Convert.ToInt32(lblScore2.Text) + 1);
             return;
         }
         ResumeGame();
     }
 }
Example #3
0
 private void fGame_KeyDown(object sender, KeyEventArgs e)
 {
     if (!timer1.Enabled)
     {
         return;
     }
     if (players[0] == false && e.KeyData == Keys.A)
     {
         GamePause();
         fMessage fm = new fMessage();
         fm.lblMessage.Text = "Игрок 1";
         SoundPlayer sp = new SoundPlayer("Resources\\1.wav");
         sp.Play();
         players[0] = true;
         if (/*MessageBox.Show("Правильный ответ?","Игрок 1", MessageBoxButtons.YesNo)*/
             fm.ShowDialog() == DialogResult.Yes)
         {
             lbCounter_1.Text = Convert.ToString(Convert.ToInt32(lbCounter_1.Text) + 1);
             MakeMusic();
         }
         GamePlay();
     }
     if (players[1] == false && e.KeyData == Keys.P)
     {
         GamePause();
         fMessage fm = new fMessage();
         fm.lblMessage.Text = "Игрок 2";
         SoundPlayer sp = new SoundPlayer("Resources\\2.wav");
         sp.Play();
         players[1] = true;
         if (/*MessageBox.Show("Правильный ответ?", "Игрок 2", MessageBoxButtons.YesNo)*/
             fm.ShowDialog() == DialogResult.Yes)
         {
             lbCounter_2.Text = Convert.ToString(Convert.ToInt32(lbCounter_2.Text) + 1);
             MakeMusic();
         }
         GamePlay();
     }
 }
Example #4
0
        private void fGame_KeyDown(object sender, KeyEventArgs e)
        {
            if (!timer1.Enabled)
            {
                return;
            }
            if (e.KeyData.ToString() == Victorina.player1Key && !playersSteps[0])
            {
                //SoundPlayer sp = new SoundPlayer("Resources\\1.wav");
                //sp.PlaySync();
                GamePause();
                fMessage fm = new fMessage();
                fm.lblPlayer.Text = "Player 1";
                playersSteps[0]   = true;
                if (fm.ShowDialog() == DialogResult.Yes)
                {
                    lblPlayer1Points.Text = Convert.ToString(Convert.ToInt32(lblPlayer1Points.Text) + 1);
                    PlayNextSong();
                }
                GamePlay();
            }
            if (e.KeyData.ToString() == Victorina.player2Key.ToString() && !playersSteps[1])
            {
                //SoundPlayer sp = new SoundPlayer("Resources\\2.wav");
                //sp.PlaySync();
                GamePause();
                fMessage fm = new fMessage();
                fm.lblPlayer.Text = "Player 2";
                playersSteps[1]   = true;

                if (fm.ShowDialog() == DialogResult.Yes)
                {
                    lblPlayer2Points.Text = Convert.ToString(Convert.ToInt32(lblPlayer2Points.Text) + 1);
                    PlayNextSong();
                }
                GamePlay();
            }
        }