示例#1
0
        public int SetbyID(int ID, Tile tile, TileBoard setBoard)
        {
            int minX = boardSizeX;
            int maxX = 0;
            int difX;
            int minY = boardSizeY;
            int maxY = 0;
            int difY;

            for (int x = 0; x < boardSizeX; x++)
            {
                for (int y = 0; y < boardSizeY; y++)
                {
                    if (board[x, y].ID == ID)
                    {
                        if (x < minX)
                        {
                            minX = x;
                        }
                        if (x > maxX)
                        {
                            maxX = x;
                        }
                        if (y < minY)
                        {
                            minY = y;
                        }
                        if (y > maxY)
                        {
                            maxY = y;
                        }
                    }
                }
            }
            difX = (maxX - minX) + 1;
            difY = (maxY - minY) + 1;
            TileBoard foundBoard = new TileBoard(difX, difY);

            for (int x = 0; x < difX; x++)
            {
                for (int y = 0; y < difY; y++)
                {
                    foundBoard.board[x, y] = new Tile(board[x + minX, y + minY]);
                }
            }
            foundBoard.FloodBoard(new Tile(tile));
            setBoard.overlayOnMe(foundBoard, minX, minY);
            return(difX * difY);
        }
示例#2
0
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //

            gameBoard = new TileBoard(BoardSize, BoardSize);
            gameBoard.FloodBoard(new Tile(0, "empty"));
            mainWindow  = new gameWindow(newRectPoint2Point(allignPoint(this.ClientRectangle, borderSize, 0), allignPoint(this.ClientRectangle, 100 - borderSize, 100)), picMain, 100, 100);
            leftWindow  = new gameWindow(newRectPoint2Point(allignPoint(this.ClientRectangle, 0, 0), allignPoint(this.ClientRectangle, borderSize, 100)), picMain, borderSize, borderSize);
            rightWindow = new gameWindow(newRectPoint2Point(allignPoint(this.ClientRectangle, 100 - borderSize, 0), allignPoint(this.ClientRectangle, 100, 100)), picMain, borderSize, borderSize);
            mainWindow.setState("Title");
            leftWindow.setState("OJ");
            rightWindow.setState("Scores");
            lostWidth  = this.Width - this.ClientRectangle.Width;
            lostHeight = this.Height - this.ClientRectangle.Height;
            mouseDown  = false;
        }