mchess-client/lib/chess_bloc/chess_events.dart

57 lines
1.2 KiB
Dart
Raw Permalink 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 ReceivedMove extends ChessEvent {
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
}
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,
});
}