2023-08-14 15:04:25 +00:00
|
|
|
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 {}
|
|
|
|
|
2023-12-09 19:34:52 +00:00
|
|
|
class ReceivedBoardState extends ChessEvent {
|
|
|
|
final ChessCoordinate? startSquare;
|
|
|
|
final ChessCoordinate? endSquare;
|
2023-09-04 19:39:51 +00:00
|
|
|
final ChessPosition position;
|
|
|
|
final ChessCoordinate squareInCheck;
|
2023-12-25 17:08:21 +00:00
|
|
|
final ChessColor turnColor;
|
2024-05-19 19:18:47 +00:00
|
|
|
final ChessColor playerColor;
|
2023-09-04 19:39:51 +00:00
|
|
|
|
2023-12-09 19:34:52 +00:00
|
|
|
ReceivedBoardState({
|
2023-09-04 19:39:51 +00:00
|
|
|
required this.startSquare,
|
|
|
|
required this.endSquare,
|
|
|
|
required this.position,
|
|
|
|
required this.squareInCheck,
|
2023-12-25 17:08:21 +00:00
|
|
|
required this.turnColor,
|
2024-05-19 19:18:47 +00:00
|
|
|
required this.playerColor,
|
2023-09-04 19:39:51 +00:00
|
|
|
});
|
2023-07-03 17:41:12 +00:00
|
|
|
}
|
|
|
|
|
2023-01-30 21:39:13 +00:00
|
|
|
class OwnPieceMoved extends ChessEvent {
|
|
|
|
final ChessCoordinate startSquare;
|
|
|
|
final ChessCoordinate endSquare;
|
|
|
|
|
2024-01-05 21:59:31 +00:00
|
|
|
OwnPieceMoved({required this.startSquare, required this.endSquare});
|
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 {
|
2024-05-19 19:18:47 +00:00
|
|
|
final ChessColor playerColor;
|
2022-12-18 00:04:08 +00:00
|
|
|
|
2024-05-19 19:18:47 +00:00
|
|
|
ColorDetermined({required this.playerColor});
|
2022-12-18 00:04:08 +00:00
|
|
|
}
|
2023-06-28 10:37:59 +00:00
|
|
|
|
|
|
|
class InvalidMovePlayed extends ChessEvent {
|
|
|
|
final ChessMove move;
|
2023-09-04 19:39:51 +00:00
|
|
|
final ChessCoordinate squareInCheck;
|
2023-06-28 10:37:59 +00:00
|
|
|
|
2023-09-04 19:39:51 +00:00
|
|
|
InvalidMovePlayed({
|
|
|
|
required this.move,
|
|
|
|
required this.squareInCheck,
|
|
|
|
});
|
2023-06-28 10:37:59 +00:00
|
|
|
}
|