Exemple #1
0
 private void QuestionWindow_KeyDown(object sender, KeyEventArgs e)
 {
     ;
     if (!_keyAlreadyPressed)
     {
         if (e.KeyCode == Keys.H)
         {
             // Spieler 1
             playerAlert(0);
         }
         else if (e.KeyCode == Keys.L)
         {
             // Spieler 2
             playerAlert(1);
         }
         else if (e.KeyCode == Keys.Oem7)
         {
             // Spieler 3
             playerAlert(2);
         }
     }
     else
     {
         if (e.KeyCode == Keys.C)
         {
             _par.updateScore(_curPlayer, _value);
             _par.questionAnswered(_cat, _value, _curPlayer);
             Console.WriteLine("Correct answer: " + _par.GetPlayerName(_curPlayer) + ": " + _value + "");
             this.Close();
         }
         else if (e.KeyCode == Keys.V)
         {
             _par.updateScore(_curPlayer, -_value);
             _keyAlreadyPressed = false;
             alertLabel.Hide();
             Console.WriteLine("Wrong answer: " + _par.GetPlayerName(_curPlayer) + ": -" + _value + "");
             _curPlayer = -1;
             if (player != null)
             {
                 player.Play();
             }
         }
     }
     if (e.KeyCode == Keys.X)
     {
         _par.questionAnswered(_cat, _value, -1);
         Console.WriteLine("No correct answer.");
         this.Close();
     }
 }