//Insert result from player 1 callback private void recieveCellWithMoveResult(int row, int col, MOVE_RESULT result) { //paint with th other color Color addColor; if (PlayerColor == Color.Red) { addColor = Color.Black; } else { addColor = Color.Red; } GameBoard[row, col] = addColor; currentColumn = col; Application.Current.Dispatcher.Invoke(new Action(() => { DrawCircle(addColor, col); })); // if we received win the the player has won if (result == MOVE_RESULT.Win) { MessageBox.Show("Oops, looks like you lost :("); Closed_from_gui = true; this.Close(); } else if (result == MOVE_RESULT.Draw) { MessageBox.Show("Game ended with draw"); Closed_from_gui = true; this.Close(); } }
private InsertResult createInsertResult(int insertionRowIndex, int column, MOVE_RESULT move) { InsertResult result = new InsertResult(); result.Row_index = insertionRowIndex; result.Move_result = move; return(result); }
private void updateCellForAnotherPlayer(string playername, int insertionRowIndex, int column, PlayingGame currentGame, MOVE_RESULT move) { // update other player that the other one has own if (playername == currentGame.Player1) { currentGame.CallBackPlayer2.updateCell(insertionRowIndex, column, move); } else if (playername == currentGame.Player2) { currentGame.CallBackPlayer1.updateCell(insertionRowIndex, column, move); } }
public void updateCell(int row, int col, MOVE_RESULT result) { updateCellFunc(row, col, result); }