mchess-client/lib/chess_bloc/chess_events.dart

71 lines
1.6 KiB
Dart
Raw Normal View History

import 'package:mchess/chess_bloc/chess_position.dart';
2022-12-25 15:16:23 +00:00
import 'package:mchess/utils/chess_utils.dart';
2022-11-13 12:10:06 +00:00
abstract class ChessEvent {}
class ReceivedBoardState extends ChessEvent {
final ChessCoordinate? startSquare;
final ChessCoordinate? endSquare;
final ChessPosition position;
final ChessCoordinate squareInCheck;
2023-12-25 17:08:21 +00:00
final ChessColor turnColor;
ReceivedBoardState({
required this.startSquare,
required this.endSquare,
required this.position,
required this.squareInCheck,
2023-12-25 17:08:21 +00:00
required this.turnColor,
});
2023-07-03 17:41:12 +00:00
}
class OwnPieceMoved extends ChessEvent {
final ChessCoordinate startSquare;
final ChessCoordinate endSquare;
2023-07-01 07:29:43 +00:00
final ChessPiece piece;
2023-07-01 07:29:43 +00:00
OwnPieceMoved(
{required this.startSquare,
required this.endSquare,
required this.piece});
2022-11-13 12:10:06 +00:00
}
2023-07-03 17:41:12 +00:00
class OwnPromotionPlayed extends ChessEvent {
final ChessPieceClass pieceClass;
final ChessMove move;
OwnPromotionPlayed({required this.pieceClass, required this.move});
}
2022-12-18 00:04:08 +00:00
class InitBoard extends ChessEvent {
InitBoard();
2022-11-13 12:10:06 +00:00
}
2022-12-18 00:04:08 +00:00
class ColorDetermined extends ChessEvent {
final ChessColor myColor;
ColorDetermined({required this.myColor});
}
class InvalidMovePlayed extends ChessEvent {
final ChessMove move;
final ChessCoordinate squareInCheck;
InvalidMovePlayed({
required this.move,
required this.squareInCheck,
});
}
class BoardStatusReceived extends ChessEvent {
final ChessPosition pos;
final ChessColor myColor;
final ChessColor whoseTurn;
BoardStatusReceived({
required this.pos,
required this.myColor,
required this.whoseTurn,
});
}