Palette.cs
(开头部分) 12KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Drawing;
using System.Threading;
using System.Timers;
namespace Tetris
{
class Palette
{
private int _width = 15; //画板宽度
private int _height = 25; //画板高度
private Color[,] coorArr; //固定方块数组
private Color disapperColor; //背景色
private Graphics gpPalette; //方块活动画板
private Graphics gpReady; //下一个方块样式画板
private BlockGroup bGroup; //方块生产机
private Block runBlock; //正在活动的方块
private Block readyBlock; //下一个方块
private int rectPix; //单元格像素
private int _score = 0; //分数
private System.Windows.Forms.TextBox tbScore;
private System.Timers.Timer timerBlock; //定时器
private int timeSpan = 800; //定时器时间间隔
private int _lv = 1;
public Palette(int x,int y,int pix,Color dColor,Graphics gp,Graphics gr, System.Windows.Forms.TextBox tb) //构造函数
{
_width = x;
_height = y;
coorArr = new Color[_width, _height];
disapperColor = dColor;
gpPalette = gp;
gpReady = gr;
rectPix = pix;
tbScore = tb;
}
public void Start() //游戏开始
{
bGroup = new BlockGroup();
runBlock = bGroup.GetABlock();
runBlock.XPos = _width / 2;
int y = 0;
for (int i = 0; i < runBlock.Length; i++)
{
if(runBlock[i].Y > y)
{
y = runBlock[i].Y;
}
}
runBlock.YPos = y;
gpPalette.Clear(disapperColor);//清空画板
runBlock.Paint(gpPalette);//话运行方块
Thread.Sleep(20);
readyBlock = bGroup.GetABlock(); //去另一个方块付给readyBlock
readyBlock.XPos = 2;
readyBlock.YPos = 2;
gpReady.Clear(disapperColor);
readyBlock.Paint(gpReady);
timerBlock = new System.Timers.Timer(timeSpan);
timerBlock.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);
后面还有 282 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。