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

@@ -75,13 +75,13 @@ public class MoveCommand extends PlayerCommand {
}
if (tryPromote(game, outputSystem)) {
outputSystem.onMove(this.move);
outputSystem.onMove(this.move, this.deadPiece != null);
return CommandResult.ActionNeeded;
}
board.setLastMove(this.move);
outputSystem.onMove(this.move);
outputSystem.onMove(this.move, this.deadPiece != null);
return CommandResult.Moved;
}

View File

@@ -81,8 +81,8 @@ public class AsyncGameDispatcher extends GameDispatcher {
}
@Override
public void onMove(Move move) {
asyncForEachCall((l) -> l.onMove(move));
public void onMove(Move move, boolean captured) {
asyncForEachCall((l) -> l.onMove(move, captured));
}
@Override

View File

@@ -32,7 +32,7 @@ public class EmptyGameDispatcher extends GameDispatcher {
}
@Override
public void onMove(Move move) {
public void onMove(Move move, boolean captured) {
}
@Override

View File

@@ -38,7 +38,7 @@ public abstract class GameAdaptator implements GameListener {
public void onGameEnd() {}
@Override
public void onMove(Move move) {}
public void onMove(Move move, boolean captured) {}
@Override
public void onMoveNotAllowed(Move move) {}

View File

@@ -41,8 +41,9 @@ public interface GameListener {
* Invoked when a valid move on the board occurs
*
* @param move the move to be processed
* @param captured whether the move is a result of a capture
*/
void onMove(Move move);
void onMove(Move move, boolean captured);
/**
* Invoked when a sent move is not allowed