Fix turnColor handling
This commit is contained in:
parent
ba947ae5e4
commit
289ec6db26
@ -27,7 +27,7 @@ class ChessApp extends StatelessWidget {
|
|||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
),
|
),
|
||||||
routerConfig: ChessAppRouter.getInstance().router,
|
routerConfig: ChessAppRouter.getInstance().router,
|
||||||
title: 'mChess 0.1339',
|
title: 'mChess 0.1.1340',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,8 @@ class ChessBloc extends Bloc<ChessEvent, ChessBoardState> {
|
|||||||
.recordMove(event.startSquare, event.endSquare, event.position);
|
.recordMove(event.startSquare, event.endSquare, event.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
turnColor = event.turnColor;
|
||||||
|
|
||||||
emit(
|
emit(
|
||||||
ChessBoardState(
|
ChessBoardState(
|
||||||
state.bottomColor,
|
state.bottomColor,
|
||||||
|
@ -8,12 +8,14 @@ class ReceivedBoardState extends ChessEvent {
|
|||||||
final ChessCoordinate? endSquare;
|
final ChessCoordinate? endSquare;
|
||||||
final ChessPosition position;
|
final ChessPosition position;
|
||||||
final ChessCoordinate squareInCheck;
|
final ChessCoordinate squareInCheck;
|
||||||
|
final ChessColor turnColor;
|
||||||
|
|
||||||
ReceivedBoardState({
|
ReceivedBoardState({
|
||||||
required this.startSquare,
|
required this.startSquare,
|
||||||
required this.endSquare,
|
required this.endSquare,
|
||||||
required this.position,
|
required this.position,
|
||||||
required this.squareInCheck,
|
required this.squareInCheck,
|
||||||
|
required this.turnColor,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,8 +104,9 @@ class ServerConnection {
|
|||||||
position: ChessPositionManager.getInstance()
|
position: ChessPositionManager.getInstance()
|
||||||
.fromPGNString(apiMessage.position!),
|
.fromPGNString(apiMessage.position!),
|
||||||
squareInCheck: ChessCoordinate.fromApiCoordinate(
|
squareInCheck: ChessCoordinate.fromApiCoordinate(
|
||||||
apiMessage.squareInCheck ?? const ApiCoordinate(col: 0, row: 0)),
|
apiMessage.squareInCheck ??
|
||||||
),
|
const ApiCoordinate(col: 0, row: 0)),
|
||||||
|
turnColor: ChessColor.fromApiColor(apiMessage.turnColor!)),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
log('Error: no position received');
|
log('Error: no position received');
|
||||||
|
Loading…
Reference in New Issue
Block a user