public void show() { for (int i = 0; i < shopItems.Length; i++) { WindowControls.Register(shopItems[i].button); } }
public Tile(int iX, int iY, int iWid, int iHei, GameBoard board, ButtonStyle tileStyle) : base(iX, iY, iWid, iHei, " ", tileStyle) { ownerBoard = board; highlightAlpha = 128; highlightColor = 0xFFFFFFFF; clickedAction = tileClicked; WindowControls.Register(this); }
public void enableBoard(bool isEnabled) { for (int iX = 0; iX < TILES_WIDE; iX++) { for (int iY = 0; iY < TILES_HIGH; iY++) { if (isEnabled) { WindowControls.Register(gameBoard[iX, iY]); } else { WindowControls.Unregister(gameBoard[iX, iY]); } } } }
// Initalize the graphics resources static void initalize() { createFonts(); // Calculate the gameboard size int boardSzX = (int)(SCREEN_WIDTH / 2f); int boardSzY = (int)(SCREEN_WIDTH / 2f); // Create the gameboard boardX = SCREEN_WIDTH / 2 - boardSzX / 2; boardY = (int)(SCREEN_HEIGHT / 2.5) - boardSzY / 2; board = new GameBoard(boardX, boardY, boardSzX, boardSzY); // Calculate the region bounds boardRegion = new Region(boardX, boardY, boardX + boardSzX, boardY + boardSzY); topRegion = new Region(0, 0, SCREEN_WIDTH, boardRegion.top); bottomRegion = new Region(0, boardRegion.bottom, SCREEN_WIDTH, SCREEN_HEIGHT); leftRegion = new Region(0, topRegion.bottom, boardRegion.left, bottomRegion.top); rightRegion = new Region(boardRegion.right, topRegion.bottom, SCREEN_WIDTH, bottomRegion.top); int btnEndTurnSize = 100; btnEndTurn = new GameButton(bottomRegion.left, bottomRegion.top, btnEndTurnSize, btnEndTurnSize, "END TURN", changeTurn); WindowControls.Register(btnEndTurn); players[0] = new Player(100); currentPlayer = players[0]; players[1] = new Player(100); players[1].isAltPlayer = true; //plag set PieceShop playerShop0 = new PieceShop("res//shopE.png", 99, players[0], SCREEN_WIDTH, SCREEN_HEIGHT, new Pos(0, 0), 0xFFDDE000); PieceShop playerShop1 = new PieceShop("res//shop.png", 99, players[1], SCREEN_WIDTH, SCREEN_HEIGHT, new Pos(0, 0), 0xFFDDE000); players[0].addPiece(0, 0, playerShop0, board); players[1].addPiece(0, 0, playerShop1, board); players[0].addPiece(0, 5, new Piece("res//queenE.png", 10, players[0], Piece.MOVEMODE.QUEEN), board); }