protected virtual void OnPieceMoved(Piece piece, Coords fromCoords, Coords newCoords) { PieceMoved?.Invoke(this, new PieceMovedArgs() { MovedPiece = piece, FromCoords = fromCoords, NewCoords = newCoords }); }
public ChessBroadCaster(NavigationManager navigationManager) { hubConnection = new HubConnectionBuilder() .WithUrl(navigationManager.ToAbsoluteUri("/chesshub")) .Build(); hubConnection.On(nameof(StartGame), (string _game) => { var game = JsonConvert.DeserializeObject <Game>(_game); StartGame?.Invoke(game); }); hubConnection.On(nameof(AddedToQueue), () => AddedToQueue?.Invoke()); hubConnection.On(nameof(IsWinner), () => IsWinner?.Invoke()); hubConnection.On(nameof(IsLooser), () => IsLooser?.Invoke()); hubConnection.On(nameof(PieceMoved), (Position from, Position to) => PieceMoved?.Invoke(from, to)); }
void ApplyMove(PieceMove move) { chessBoard.Board[move.originPos.row, move.originPos.column] = null; chessBoard.Board[move.newPos.row, move.newPos.column] = move.piece; PieceMoved?.Invoke(move.originPos, move.newPos); }
protected virtual void OnPieceMoved(Point i_Location, Point i_Destination) { PieceMoved?.Invoke(i_Location, i_Destination); }
private void OnPieceMoved(PieceMovedEventArgs e) { PieceMoved?.Invoke(this, e); }