• 大小: 85KB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2024-02-03
  • 语言: C#
  • 标签: AI  

资源简介

俄罗斯方块的外挂代码,可能有些老,用钩子实现的,但对初学者比较合适

资源截图

代码片段和文件信息

namespace TetrisAssistant
{
    class BrickOperator
    {
        #region 字段

        public const int KEY_LEFT = 0x25;
        public const int KEY_UP = 0x26;
        public const int KEY_RIGHT = 0x27;
        public const int KEY_DOWN = 0x28;
        public const int KEY_SPACE = 0x20;

        static bool[] bGamePanel;
        static bool[] bBrick;
        static int iRow iColumn;

        #endregion

        #region 属性

        public static bool[] BGamePanel
        {
            set
            {
                bGamePanel = value;
            }
        }
        public static bool[] BBrick
        {
            set
            {
                bBrick = value;
            }
        }
        public static int Row
        {
            set
            {
                iRow = value;
            }
        }
        public static int Column
        {
            set
            {
                iColumn = value;
            }
        }

        #endregion

        #region 方法

        public static bool LeftBrick()
        {
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    if(bBrick[i j])
                    {
                        if (iColumn + j - 1 < 0
                            || bGamePanel[iRow + i iColumn + j - 1])
                            return false;
                    }
                }
            }

            iColumn -= 1;
            return true;
        }

        public static bool RightBrick()
        {
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (bBrick[i j])
                    {
                        if (iColumn + j + 1 >= bGamePanel.GetLength(1)
                            || bGamePanel[iRow + i iColumn + j + 1])
                            return false;
                    }
                }
            }

            iColumn += 1;
            return true;
        }

        public static void RevolveBrick()
        {
            ///正方形
            if (bBrick[1 1] && bBrick[1 2]
                && bBrick[2 1] && bBrick[2 2])
                return;

            bool[] temp = new bool[4 4];
            for (int i = 0; i < 4; i++)
                for (int j = 0; j < 4; j++)
                    temp[i j] = false;
            ///行长方形
            if (bBrick[1 3])
                for (int i = 0; i < 4; i++)
                    temp[i 2] = true;
            ///竖长方形
            else if (bBrick[3 2])
                for (int j = 0; j < 4; j++)
                    temp[1 j] = true;
            ///行Z形
            else if (bBrick[1 0] && bBrick[1 1]
                && bBrick[2 1] && bBrick[2 2])
            {
                temp[0 2] = true;
                temp[1 1] = true;
                temp[1 2] =

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2009-01-14 18:38  TetrisAssistant\
     文件        8704  2009-01-02 23:38  TetrisAssistant\GetColor.exe
     目录           0  2009-03-02 18:42  TetrisAssistant\TetrisAssistant\
     文件        4894  2009-01-09 23:10  TetrisAssistant\TetrisAssistant\BrickOperator.cs
     文件         373  2009-01-04 08:24  TetrisAssistant\TetrisAssistant\IAssistant.cs
     文件         520  2009-01-01 10:47  TetrisAssistant\TetrisAssistant\Program.cs
     目录           0  2009-01-14 18:38  TetrisAssistant\TetrisAssistant\Properties\
     文件        1442  2009-01-01 10:46  TetrisAssistant\TetrisAssistant\Properties\AssemblyInfo.cs
     文件        2859  2009-01-01 10:46  TetrisAssistant\TetrisAssistant\Properties\Resources.Designer.cs
     文件        5612  2009-01-01 10:46  TetrisAssistant\TetrisAssistant\Properties\Resources.resx
     文件        1100  2009-01-01 10:46  TetrisAssistant\TetrisAssistant\Properties\Settings.Designer.cs
     文件         249  2009-01-01 10:46  TetrisAssistant\TetrisAssistant\Properties\Settings.settings
     文件        4750  2009-01-14 20:52  TetrisAssistant\TetrisAssistant\Score.cs
     文件       14132  2009-01-14 20:49  TetrisAssistant\TetrisAssistant\TetrisAssistant.cs
     文件        4387  2009-01-14 08:04  TetrisAssistant\TetrisAssistant\TetrisAssistant.csproj
     目录           0  2009-01-14 18:38  TetrisAssistant\TetrisAssistant\bin\
     目录           0  2009-01-24 20:42  TetrisAssistant\TetrisAssistant\bin\Debug\
     文件       22528  2009-01-24 20:42  TetrisAssistant\TetrisAssistant\bin\Debug\TetrisAssistant.exe
     文件       56832  2009-01-24 20:42  TetrisAssistant\TetrisAssistant\bin\Debug\TetrisAssistant.pdb
     文件       14328  2011-03-16 16:00  TetrisAssistant\TetrisAssistant\bin\Debug\TetrisAssistant.vshost.exe
     文件         490  2007-07-21 01:33  TetrisAssistant\TetrisAssistant\bin\Debug\TetrisAssistant.vshost.exe.manifest
     文件        6045  2009-01-12 13:58  TetrisAssistant\TetrisAssistant\frmTetrisAssistant.Designer.cs
     文件        2802  2009-01-13 09:49  TetrisAssistant\TetrisAssistant\frmTetrisAssistant.cs
     文件        5814  2009-01-10 22:27  TetrisAssistant\TetrisAssistant\frmTetrisAssistant.resx
     文件        3389  2009-01-10 22:13  TetrisAssistant\TetrisAssistant\frmTetrisGrid.Designer.cs
     文件        2261  2009-01-11 09:44  TetrisAssistant\TetrisAssistant\frmTetrisGrid.cs
     文件        6010  2009-01-10 22:13  TetrisAssistant\TetrisAssistant\frmTetrisGrid.resx
     目录           0  2009-01-14 18:38  TetrisAssistant\TetrisAssistant\obj\
     目录           0  2009-01-24 20:42  TetrisAssistant\TetrisAssistant\obj\Debug\
     目录           0  2012-09-05 09:54  TetrisAssistant\TetrisAssistant\obj\Debug\Refactor\
     目录           0  2012-09-05 09:54  TetrisAssistant\TetrisAssistant\obj\Debug\TempPE\
............此处省略9个文件信息

评论

共有 条评论