Esempio n. 1
0
 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));
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 protected virtual void OnPieceMoved(Point i_Location, Point i_Destination)
 {
     PieceMoved?.Invoke(i_Location, i_Destination);
 }
Esempio n. 5
0
 private void OnPieceMoved(PieceMovedEventArgs e)
 {
     PieceMoved?.Invoke(this, e);
 }