diff --git a/lib/chess/chess_app.dart b/lib/chess/chess_app.dart index 18e2595..2a332c8 100644 --- a/lib/chess/chess_app.dart +++ b/lib/chess/chess_app.dart @@ -27,7 +27,7 @@ class ChessApp extends StatelessWidget { useMaterial3: true, ), routerConfig: ChessAppRouter.getInstance().router, - title: 'mChess 0.1339', + title: 'mChess 0.1.1340', ), ); } diff --git a/lib/chess_bloc/chess_bloc.dart b/lib/chess_bloc/chess_bloc.dart index 2f76146..e66e3d4 100644 --- a/lib/chess_bloc/chess_bloc.dart +++ b/lib/chess_bloc/chess_bloc.dart @@ -75,6 +75,8 @@ class ChessBloc extends Bloc { .recordMove(event.startSquare, event.endSquare, event.position); } + turnColor = event.turnColor; + emit( ChessBoardState( state.bottomColor, diff --git a/lib/chess_bloc/chess_events.dart b/lib/chess_bloc/chess_events.dart index f0f1ad1..c657bc8 100644 --- a/lib/chess_bloc/chess_events.dart +++ b/lib/chess_bloc/chess_events.dart @@ -8,12 +8,14 @@ class ReceivedBoardState extends ChessEvent { final ChessCoordinate? endSquare; final ChessPosition position; final ChessCoordinate squareInCheck; + final ChessColor turnColor; ReceivedBoardState({ required this.startSquare, required this.endSquare, required this.position, required this.squareInCheck, + required this.turnColor, }); } diff --git a/lib/connection/ws_connection.dart b/lib/connection/ws_connection.dart index 16114ff..b9f8240 100644 --- a/lib/connection/ws_connection.dart +++ b/lib/connection/ws_connection.dart @@ -99,13 +99,14 @@ class ServerConnection { if (apiMessage.position != null) { ChessBloc.getInstance().add( ReceivedBoardState( - startSquare: move?.from, - endSquare: move?.to, - position: ChessPositionManager.getInstance() - .fromPGNString(apiMessage.position!), - squareInCheck: ChessCoordinate.fromApiCoordinate( - apiMessage.squareInCheck ?? const ApiCoordinate(col: 0, row: 0)), - ), + startSquare: move?.from, + endSquare: move?.to, + position: ChessPositionManager.getInstance() + .fromPGNString(apiMessage.position!), + squareInCheck: ChessCoordinate.fromApiCoordinate( + apiMessage.squareInCheck ?? + const ApiCoordinate(col: 0, row: 0)), + turnColor: ChessColor.fromApiColor(apiMessage.turnColor!)), ); } else { log('Error: no position received');