//--------------------------------------------------------------------------------------// // initialize UIBoard // //--------------------------------------------------------------------------------------// private void initializeBoard(byte i_BoardSize, string i_Player1Name, string i_Player2Name, bool i_IsLoadedGame, List <Piece> i_ListOfPlayer1Pieces, List <Piece> i_ListOfPlayer2Pieces) { resizeBoard(i_BoardSize); initializePlayerTurnLabelAndPictureBox(); initializeScoresLabel(i_BoardSize, i_Player1Name, i_Player2Name); m_ImageOnBoard = new PiecesPictureBox[(byte)i_BoardSize, (byte)i_BoardSize]; for (byte row = 0; row < (byte)i_BoardSize; row++) { for (byte column = 0; column < (byte)i_BoardSize; column++) { Coordinates currentCoordinateImage = new Coordinates(row, column); m_ImageOnBoard[row, column] = new PiecesPictureBox(currentCoordinateImage); this.Controls.Add(m_ImageOnBoard[row, column]); } } if (i_IsLoadedGame == false) { initializeTheFourFirstImages(i_BoardSize); } else { initializeLoadedPiecesAndUpdateScore(i_ListOfPlayer1Pieces); initializeLoadedPiecesAndUpdateScore(i_ListOfPlayer2Pieces); } }
//--------------------------------------------------------------------------------------// // Listeners functions // //--------------------------------------------------------------------------------------// private void PlayerClickedImagedOnBoard(object i_ImagedOnBoard, EventArgs e) { PiecesPictureBox ImagedOnBoard = i_ImagedOnBoard as PiecesPictureBox; PlayerMakeAMove.Invoke(ImagedOnBoard.ImageCoordinate); }