Block.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;//add
namespace 俄罗斯方块
{
public class Block
{
private short width;
private short height;
private short top;
private short left;
private int ID; //方块部件的ID
public int[,] shape; //存储方块部件的形状,0为空白,1为有砖块
public Block()//构造函数
{
Random randomGenerator = new Random();
int randomBlock = randomGenerator.Next(1, 5);//产生1—4的数
this.ID = randomBlock;
switch (this.ID)
{
case 1: //横条形
this.Width = 4;
this.Height = 1;
this.Top = 0;
this.Left = 3;
shape = new int[this.Width, this.Height];
shape[0, 0] = 1; shape[1, 0] = 1;
shape[2, 0] = 1; shape[3, 0] = 1;
break;
case 2: //正方形
this.Width = 2;
this.Height = 2;
this.Top = 0;
this.Left = 4;
// Creates the new shape for this block.
shape = new int[this.Width, this.Height];
shape[0, 0] = 1; shape[0, 1] = 1;
shape[1, 0] = 1;shape[1, 1] = 1;
break;
case 3: //T形
this.Width = 3;
this.Height = 3;
this.Top = 0;
this.Left = 4;
// Creates the new shape for this block.
shape = new int[this.Width, this.Height];
shape[0, 0] = 1; shape[1, 0] = 1;
shape[2, 0] = 1; shape[1, 1] = 1;
shape[1, 2] = 1;
break;
case 4: //L形
this.Width = 2;
this.Height = 3;
this.Top = 0;
this.Left = 4;
// Creates the new shape for this block.
shape = new int[this.Width, this.Height];
shape[0, 0] = 1; shape[0, 1] = 1;
后面还有 66 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
