Exemple #1
0
 public void UserKeyDown(Keys c)
 {
     if (tetrisModel.GetState().Equals(TetrisModel.STATE.DOING))
     {
         if (c == Keys.A)
         {
             tetrisModel.CubeMoveRight();
         }
         else if (c == Keys.D)
         {
             tetrisModel.CubeMoveLeft();
         }
         else if (c == Keys.S)
         {
             tetrisModel.CubeMoveDown();
         }
         else if (c == Keys.C)
         {
             tetrisModel.CubeGoDown();
         }
         else if (c == Keys.Space)
         {
             tetrisModel.CubeRotate();
         }
     }
 }
Exemple #2
0
 public void UserKeyDown(Keys c)
 {
     if (tetrisModel.GetState().Equals(TetrisModel.STATE.DOING))
     {
         if (c == Keys.Up)
         {
             tetrisModel.CubeRotate();
         }
         else if (c == Keys.Down)
         {
             tetrisModel.CubeMoveDown();
         }
         else if (c == Keys.Right)
         {
             tetrisModel.CubeMoveRight();
         }
         else if (c == Keys.Left)
         {
             tetrisModel.CubeMoveLeft();
         }
         else if (c == Keys.Space)
         {
             tetrisModel.CubeGoDown();
         }
         else if (c == Keys.C)   // 更換方塊
         {
             tetrisModel.CubeChangeNext();
         }
     }
     else if (tetrisModel.GetState() == TetrisModel.STATE.STOP)
     {
         if (c == Keys.Space)
         {
             tetrisModel.GameOverPanel();
         }
     }
 }