diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Audio/Audio.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Audio/Audio.java index 1008b05..f280ae0 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Audio/Audio.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Audio/Audio.java @@ -3,14 +3,14 @@ public enum Audio { // Sound effects - OPEN_APP("/Audio/open_app.wav"), - CLOSE_APP("/Audio/close_app.wav"), - CLOCK("/Audio/clock.wav"), - TRANSACTION("/Audio/transaction.wav"), + OPEN_APP("/Audio/open_app.mp3"), + CLOSE_APP("/Audio/close_app.mp3"), + WARNING("/Audio/warning.mp3"), + CLOCK("/Audio/clock.mp3"), // Background music - WORK_THEME("/Audio/work_theme.mp3"), - WEEKEND_THEME("/Audio/weekend_theme.mp3"); + WEEKEND_THEME("/Audio/weekend_theme.mp3"), + GAME_OVER_THEME("/Audio/game_over_theme.mp3"); private String path; diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/AppControllers/StockAppController.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/AppControllers/StockAppController.java index d0ab31e..50880df 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/AppControllers/StockAppController.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/AppControllers/StockAppController.java @@ -30,7 +30,6 @@ public final class StockAppController implements AppController { private final StockApp stockApp; private final Player player; private Stock currentStock; - private AudioManager audioManager = AudioManager.getInstance(); /** True while the game is on Saturday or Sunday. */ private boolean isWeekend = false; @@ -76,7 +75,6 @@ public StockAppController( }); stockApp.getConfirmButton().setOnAction(e -> { - audioManager.playSFX(Audio.TRANSACTION); handleTransaction(); }); } diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/GameController.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/GameController.java index 9e554aa..1388ee7 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/GameController.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/GameController.java @@ -34,7 +34,7 @@ public void setGameState(GameState gameState) { this.gameState = gameState; if (gameState == GameState.WORKDAY && !workMusicPlaying) { - audioManager.playBgMusic(Audio.WORK_THEME); + //audioManager.playBgMusic(Audio.WORK_THEME); workMusicPlaying = true; weekendMusicPlaying = false; } @@ -52,7 +52,7 @@ public void setGameState(GameState gameState) { public void startGame() { timer = new Timer(true); final int delay = 0; - final int period = 50; + final int period = 1000; //TODO: This has to be 1000 (1 second) on release timer.scheduleAtFixedRate( new TimerTask() { diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/ViewControllers/DesktopViewController.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/ViewControllers/DesktopViewController.java index a648674..f128e56 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/ViewControllers/DesktopViewController.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Controller/ViewControllers/DesktopViewController.java @@ -1,5 +1,7 @@ package edu.ntnu.idi.idatt2003.gruppe42.Controller.ViewControllers; +import edu.ntnu.idi.idatt2003.gruppe42.Audio.Audio; +import edu.ntnu.idi.idatt2003.gruppe42.Audio.AudioManager; import edu.ntnu.idi.idatt2003.gruppe42.Controller.AppControllers.AppStoreController; import edu.ntnu.idi.idatt2003.gruppe42.Controller.AppControllers.BankAppController; import edu.ntnu.idi.idatt2003.gruppe42.Controller.AppControllers.StockAppController; @@ -59,6 +61,7 @@ public final class DesktopViewController { private final GameOverApp gameOverApp = new GameOverApp(); private Runnable onGameOver; + private AudioManager audioManager = AudioManager.getInstance(); public DesktopViewController(final Player player, final GameController gameController) { this.player = player; @@ -206,6 +209,7 @@ private void showMarketClosedWarning() { private void showWarning() { warningApp.show(); + audioManager.playSFX(Audio.WARNING); desktopView.enterLayer(ModalLayer.WARNING); } @@ -216,6 +220,7 @@ private void dismissWarning() { private void showGameOver() { gameOverApp.show(); + audioManager.playBgMusic(Audio.GAME_OVER_THEME); desktopView.enterLayer(ModalLayer.GAME_OVER); } diff --git a/src/main/resources/Audio/clock.mp3 b/src/main/resources/Audio/clock.mp3 new file mode 100644 index 0000000..a0394a0 Binary files /dev/null and b/src/main/resources/Audio/clock.mp3 differ diff --git a/src/main/resources/Audio/clock.wav b/src/main/resources/Audio/clock.wav deleted file mode 100644 index 67e1002..0000000 Binary files a/src/main/resources/Audio/clock.wav and /dev/null differ diff --git a/src/main/resources/Audio/close_app.mp3 b/src/main/resources/Audio/close_app.mp3 new file mode 100644 index 0000000..a351672 Binary files /dev/null and b/src/main/resources/Audio/close_app.mp3 differ diff --git a/src/main/resources/Audio/close_app.wav b/src/main/resources/Audio/close_app.wav deleted file mode 100644 index 9b6291b..0000000 Binary files a/src/main/resources/Audio/close_app.wav and /dev/null differ diff --git a/src/main/resources/Audio/game_over_theme.mp3 b/src/main/resources/Audio/game_over_theme.mp3 new file mode 100644 index 0000000..852324f Binary files /dev/null and b/src/main/resources/Audio/game_over_theme.mp3 differ diff --git a/src/main/resources/Audio/open_app.mp3 b/src/main/resources/Audio/open_app.mp3 new file mode 100644 index 0000000..9a64c82 Binary files /dev/null and b/src/main/resources/Audio/open_app.mp3 differ diff --git a/src/main/resources/Audio/open_app.wav b/src/main/resources/Audio/open_app.wav deleted file mode 100644 index 5675422..0000000 Binary files a/src/main/resources/Audio/open_app.wav and /dev/null differ diff --git a/src/main/resources/Audio/transaction.wav b/src/main/resources/Audio/transaction.wav deleted file mode 100644 index 6f135a9..0000000 Binary files a/src/main/resources/Audio/transaction.wav and /dev/null differ diff --git a/src/main/resources/Audio/warning.mp3 b/src/main/resources/Audio/warning.mp3 new file mode 100644 index 0000000..5a3ee73 Binary files /dev/null and b/src/main/resources/Audio/warning.mp3 differ diff --git a/src/main/resources/Audio/work_theme.mp3 b/src/main/resources/Audio/work_theme.mp3 deleted file mode 100644 index cc557cd..0000000 Binary files a/src/main/resources/Audio/work_theme.mp3 and /dev/null differ