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 {
|
2022-11-13 12:10:06 +00:00
|
|
|
final ChessCoordinate startSquare;
|
|
|
|
final ChessCoordinate endSquare;
|
|
|
|
|
2023-06-28 10:37:59 +00:00
|
|
|
ReceivedMove({required this.startSquare, required this.endSquare});
|
2023-01-30 21:39:13 +00:00
|
|
|
}
|
|
|
|
|
2023-07-03 17:41:12 +00:00
|
|
|
class ReceivedPromotion extends ChessEvent {
|
|
|
|
final ChessCoordinate startSquare;
|
|
|
|
final ChessCoordinate endSquare;
|
|
|
|
final String piece;
|
|
|
|
|
|
|
|
ReceivedPromotion(
|
|
|
|
{required this.startSquare,
|
|
|
|
required this.endSquare,
|
|
|
|
required this.piece});
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
InvalidMovePlayed({required this.move});
|
|
|
|
}
|