GameField.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Media;
using System.Drawing;
namespace 俄罗斯方块
{
class GameField
{
public const int width = 20, height = 30; //block的个数为单位
public const int squareSize = 15; //单位像素
public static Color backColor;
public static Color[] BlockForeColor ={ Color.Blue,Color.DarkSalmon, Color.Beige, Color.DarkKhaki, Color.DarkOrange, Color.DarkOliveGreen, Color.DarkRed };
public static Color[] BlockBackColor ={ Color.Black, Color.BlanchedAlmond, Color.BlueViolet, Color.CadetBlue, Color.Green, Color.Crimson, Color.DarkGray };
public static Square[,] arriveBlock = new Square[width, height];
public static bool[,] haveBlock = new bool[width, height];
public static Random rand = new Random();
//检测能否移动
public static bool CanMove(int x,int y)
{
if (y < 0 || y >= height)
return false;
if (x < 0 || x >= width)
return false;
if (haveBlock[x, y])
return false;
else
return true;
}
public static void StopSquare(Square sq,int x,int y)
{
arriveBlock[x, y] = sq;
haveBlock[x, y] = true;
}
private static bool isEmpty(int y)
{
for(int x=0;x<width;x++)
if (haveBlock[x, y])
return false;
return true;
}
private static bool isFull(int y)
{
for (int x = 0; x < width; x++)
if (!haveBlock[x, y])
return false;
return true;
}
private static void setEmpty(int y)
{
后面还有 59 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。