mchess-client/lib/chess_bloc/chess_events.dart

57 lines
1.3 KiB
Dart

import 'package:mchess/chess_bloc/chess_position.dart';
import 'package:mchess/utils/chess_utils.dart';
abstract class ChessEvent {}
class ReceivedBoardState extends ChessEvent {
final ChessCoordinate? startSquare;
final ChessCoordinate? endSquare;
final ChessPosition position;
final ChessCoordinate squareInCheck;
final ChessColor turnColor;
final ChessColor playerColor;
ReceivedBoardState({
required this.startSquare,
required this.endSquare,
required this.position,
required this.squareInCheck,
required this.turnColor,
required this.playerColor,
});
}
class OwnPieceMoved extends ChessEvent {
final ChessCoordinate startSquare;
final ChessCoordinate endSquare;
OwnPieceMoved({required this.startSquare, required this.endSquare});
}
class OwnPromotionPlayed extends ChessEvent {
final ChessPieceClass pieceClass;
final ChessMove move;
OwnPromotionPlayed({required this.pieceClass, required this.move});
}
class InitBoard extends ChessEvent {
InitBoard();
}
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,
});
}