⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 square.cs

📁 game tetris :), this file is a little too big but it s run well, besides, it also has file descripti
💻 CS
字号:
using System;
using System.Collections;
using System.Drawing;

namespace GATetrisControl
{ 
	internal class Square : Figure
	{
		#region Constructor

		public Square(TetrisGrid tg) : base(tg)
		{
			yPosition = 0;
			xPosition = (columns - 2) / 2;
			color = parent.settings.squareColor;
            range = 0;
		}

		#endregion

		#region Overriden Methods

		protected override ArrayList GetRectsIndexes()
		{
			ArrayList indexes = new ArrayList();
			int start = yPosition * columns + xPosition;
			indexes.Add(start);
			indexes.Add(start + 1);
			indexes.Add(start + columns);
			indexes.Add(start + columns + 1);

			width = 2;
			height = 2;

			return indexes;
		}

		internal override void DrawPreview(Graphics g)
		{
			int a = parent.settings.squareWidth;

			Rectangle r1 = new Rectangle(a * 2,a * 2,a,a);
			Rectangle r2 = new Rectangle(a * 3,a * 2,a,a);
			Rectangle r3 = new Rectangle(a * 2,a * 3,a,a);
			Rectangle r4 = new Rectangle(a * 3,a * 3,a,a);
			
			DrawPreviewSquare(r1,g, color);
			DrawPreviewSquare(r2,g, color);
			DrawPreviewSquare(r3,g, color);
			DrawPreviewSquare(r4,g, color);
		}

		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -