feat: add audio
This commit is contained in:
@@ -13,8 +13,8 @@ import chess.view.AssetManager;
|
||||
public class AudioFiles {
|
||||
|
||||
private static final String baseURL = "https://images.chesscomfiles.com/chess-themes/sounds/_WAV_/default/";
|
||||
private static final String[] files = { "game-start", "game-end", "capture", "castle", "premove", "move-self",
|
||||
"move-check", "move-opponent", "promote", "notify", "tenseconds", "illegal" };
|
||||
private static final String[] files = { "game-start", "game-end", "capture", "castle", "move-self",
|
||||
"move-check", "promote", "illegal" };
|
||||
private static final String filesExtension = ".wav";
|
||||
private static final String saveDir = "audio/";
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ public class Console implements GameListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMove(Move move) {
|
||||
public void onMove(Move move, boolean captured) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -306,7 +306,7 @@ public class Window extends JFrame implements GameListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMove(Move move) {}
|
||||
public void onMove(Move move, boolean captured) {}
|
||||
|
||||
@Override
|
||||
public void onMoveNotAllowed(Move move) {
|
||||
|
||||
Reference in New Issue
Block a user