Beispiel #1
0
 private void OnKeyDownHandler(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Up)
     {
         oGame.Update(Button.Up);
     }
     if (e.Key == Key.Down)
     {
         oGame.Update(Button.Down);
     }
     if (e.Key == Key.Left)
     {
         oGame.Update(Button.Left);
     }
     if (e.Key == Key.Right)
     {
         oGame.Update(Button.Right);
     }
     if (e.Key == Key.Enter)
     {
         if (!oGame.IsPlay())
         {
             oGame.Initialize();
         }
     }
     oGame.Render();
     if (!oGame.IsPlay())
     {
         if (oGame.IsClear())
         {
             MessageBox.Show(" Clear Game!! \n You Want more Game? \n Please Enter");
         }
         else
         {
             MessageBox.Show(" Lose!! \n You Want more Game? \n Please Enter");
         }
     }
 }