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-06-28 10:37:59 +00:00
|
|
|
class ReceivedMove extends ChessEvent {
|
2023-09-04 19:39:51 +00:00
|
|
|
final ChessCoordinate startSquare;
|
|
|
|
final ChessCoordinate endSquare;
|
|
|
|
final ChessPosition position;
|
|
|
|
final ChessCoordinate squareInCheck;
|
|
|
|
|
|
|
|
ReceivedMove({
|
|
|
|
required this.startSquare,
|
|
|
|
required this.endSquare,
|
|
|
|
required this.position,
|
|
|
|
required this.squareInCheck,
|
|
|
|
});
|
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;
|
2023-07-01 07:29:43 +00:00
|
|
|
final ChessPiece piece;
|
2023-01-30 21:39:13 +00:00
|
|
|
|
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});
|
|
|
|
}
|
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
|
|
|
}
|