feat: add audio

This commit is contained in:
2025-04-30 20:41:10 +02:00
parent 3b38e0da1f
commit 3b225d9e23
11 changed files with 47 additions and 15 deletions

View File

@@ -1,6 +1,8 @@
package chess.view.audio;
import chess.controller.commands.PromoteCommand.PromoteType;
import chess.controller.event.GameAdaptator;
import chess.model.Move;
public class GameAudio extends GameAdaptator {
@@ -28,5 +30,34 @@ public class GameAudio extends GameAdaptator {
public void onGameEnd() {
playSound("game-end");
}
@Override
public void onMoveNotAllowed(Move move) {
playSound("illegal");
}
@Override
public void onMove(Move move, boolean captured) {
if (captured) {
playSound("capture");
return;
}
playSound("move-self");
}
@Override
public void onKingInCheck() {
playSound("move-check");
}
@Override
public void onPawnPromoted(PromoteType promotion) {
playSound("promote");
}
@Override
public void onCastling(boolean bigCastling) {
playSound("castle");
}
}