Block.cs

(开头部分) 25KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Drawing;

namespace Tetris
{
    class Block
    {
        public Square square1;  //组成block的四个小方块
        public Square square2;
        public Square square3;
        public Square square4;

        private const int squareSize = GameField.SquareSize; //小方块的边长
        public enum BlockTypes
        {
            undefined = 0,
            square = 1,
            line = 2,
            J = 3,
            L = 4,
            T = 5,
            Z = 6,
            S = 7
        };//一共有7种形状
        public BlockTypes blockType;//方块的形状
        //七个小方块的颜色数组
        private Color foreColor;
        private Color backColor;
        //方块的方向
        public enum RotateDirections
        {
            North = 1,
            East = 2,
            South = 3,
            West = 4
        };
        public RotateDirections myRotation = RotateDirections.North;

        public Block(Point thisLocation, BlockTypes bType)
        { //当blockType为undefined时,随机产生方块形状
            Random rand = new Random();
            if (bType == BlockTypes.undefined)
            {
                blockType = (BlockTypes)(rand.Next(7) + 1);
            }
            else
                blockType = bType;
            //设置四小方块的颜色
            int i = (int)blockType - 1;
            foreColor = GameField.BlockForeColor[i];
            backColor = GameField.BlockBackColor[i];
            Size squareS = new Size(squareSize, squareSize);
            square1 = new Square(squareS, foreColor, backColor);
            square2 = new Square(squareS, foreColor, backColor);
            square3 = new Square(squareS, foreColor, backColor);
            square4 = new Square(squareS, foreColor, backColor);

            //设置小方块的位置,组合成指定形状的一个大方块
            switch (blockType)
            {
后面还有 390 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。