当前位置: 首页>>代码示例>>C#>>正文


C# Piece.moveLeft方法代码示例

本文整理汇总了C#中Piece.moveLeft方法的典型用法代码示例。如果您正苦于以下问题:C# Piece.moveLeft方法的具体用法?C# Piece.moveLeft怎么用?C# Piece.moveLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piece的用法示例。


在下文中一共展示了Piece.moveLeft方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: key

 public void key(Windows.System.VirtualKey e)
 {
     switch (e)
     {
         case Windows.System.VirtualKey.Space:
             actions++;
             Piece proj = this.board.projection(p);
             this.points += 2*(proj.getRow()-p.getRow());
             ((TextBlock)tsp.FindName("pointsText")).Text = "Points :" + points.ToString();
             this.p = proj;
             this.moveDown();
             ticks = 0;
             //this.moveDown();
             break;
         case Windows.System.VirtualKey.Up:
             actions++;
             p.rotate_right();
             if (this.board.intersectsAndOutOfBounds(p, 0, 0))//choca despues de intersectar
             {
                 if (!this.board.intersectsAndOutOfBounds(p, -1, 0))
                 {
                     p.moveLeft();
                     break;
                 }
                 else if (!this.board.intersectsAndOutOfBounds(p, 1, 0))
                 {
                     p.moveRight();
                     break;
                 }
                 else if (!this.board.intersectsAndOutOfBounds(p, 2, 0))
                 {
                     p.moveRight();
                     p.moveRight();
                     break;
                 }
                 p.rotate_left();
             }
             break;
         case Windows.System.VirtualKey.Down:
             actions++;
             this.points += 1;
             ((TextBlock)tsp.FindName("pointsText")).Text = "Points :" + this.points.ToString();
             this.moveDown();
             this.ticks = 0;
             break;
         case Windows.System.VirtualKey.Left:
             actions++;
             if (!this.board.intersectsAndOutOfBounds(p, -1, 0))
                 p.moveLeft();
             break;
         case Windows.System.VirtualKey.Right:
             actions++;
             if (!this.board.intersectsAndOutOfBounds(p, 1, 0))
                 p.moveRight();
             break;
         case Windows.System.VirtualKey.Shift:
             break;
     }
     this.draw();
 }
开发者ID:dchelm,项目名称:MultiplayerTetris,代码行数:60,代码来源:SPGameController.cs


注:本文中的Piece.moveLeft方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。