public void TileActivate(BoardSquare Tile) { //Opvragen locations voor aangeklikte stuk int i, j; i = Tile.posY; j = Tile.posX; switch (locations[i, j]) { //nieuw speelstuk activeren case 1: if (!isTileActivated) { SpeelStuk(chessBoardIntel[i, j], i, j); Activate(); I = i; J = j; } break; //geactiveerde speelstuk naar mogelijke locatie brengen case 2: change(i, j); Activate(); break; //geactiveerde speelstuk deactiveren case 3: if (isTileActivated) { validate(); Activate(); } break; } }
public void TileClick(BoardSquare B) { //tile meegeven mChess.TileActivate(B); }
//methode nieuw bord aanmaken public void NieuwBord(Chessboard T, ChessController deController) { controller = deController; //Aanmaken bord intel chessBoardIntel = new string[8, 8]{ {"bT","bP","bP","bP","bP","bP","bP","bT" }, {"bP","bP","bP","bP","bP","bP","bP","bP" }, {"E","E","E","E","E","E","E","E" }, {"E","E","E","E","E","E","E","E" }, {"E","E","E","E","E","E","E","E" }, {"E","E","E","E","E","E","E","E" }, {"wP","wP","wP","wP","wP","wP","wP","wP" }, {"wT","wP","wP","wP","wP","wP","wP","wT" }}; //Aanmaken boardsquares array chessBoardUI = new BoardSquare[8, 8]; //aanmaken mogelijke zetten array locations = new int[8, 8]; //aanmaken boardsquares for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { chessBoardUI[i, j] = new BoardSquare(deController); chessBoardUI[i, j].Parent = T; chessBoardUI[i, j].Location = new Point(j * 75 + 75, i * 75 + 75); chessBoardUI[i, j].posX = j; chessBoardUI[i, j].posY = i; chessBoardUI[i, j].Size = new Size(75, 75); //black/white DrawCheckers(i, j); } } //SCorebord aanmaken om te tonen op het formulier scoreBord = new ScoreBord(deController); scoreBord.Parent = T; scoreBord.Location = new Point(675,75); validate(); drawing(); }