From 625ddf1ce92f341344ad6fa4fd7dc925a93d4b92 Mon Sep 17 00:00:00 2001 From: heurtet Date: Fri, 14 May 2021 15:15:02 +0200 Subject: [PATCH] correction bug volume musiques --- core/src/sagittarius/view/CreditScreen.java | 1 + core/src/sagittarius/view/GameScreen.java | 1 + core/src/sagittarius/view/ResumeScreen.java | 4 ++++ core/src/sagittarius/view/SettingsScreen.java | 3 +++ core/src/sagittarius/view/StartScreen.java | 3 +++ 5 files changed, 12 insertions(+) diff --git a/core/src/sagittarius/view/CreditScreen.java b/core/src/sagittarius/view/CreditScreen.java index 3a4954d..b7de2f6 100644 --- a/core/src/sagittarius/view/CreditScreen.java +++ b/core/src/sagittarius/view/CreditScreen.java @@ -21,6 +21,7 @@ public class CreditScreen extends BaseScreen { SagittariusGame.music.stop(); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/credit_music.mp3")); SagittariusGame.music.setLooping(true); + SagittariusGame.music.setVolume(SagittariusGame.musicVolume); SagittariusGame.music.play(); } diff --git a/core/src/sagittarius/view/GameScreen.java b/core/src/sagittarius/view/GameScreen.java index 432aa6e..21e654e 100644 --- a/core/src/sagittarius/view/GameScreen.java +++ b/core/src/sagittarius/view/GameScreen.java @@ -53,6 +53,7 @@ public class GameScreen extends BaseScreen implements InputProcessor { SagittariusGame.music.stop(); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/game_music.mp3")); SagittariusGame.music.setLooping(true); + SagittariusGame.music.setVolume(SagittariusGame.musicVolume); SagittariusGame.music.play(); } diff --git a/core/src/sagittarius/view/ResumeScreen.java b/core/src/sagittarius/view/ResumeScreen.java index ec9c49b..218e1a6 100644 --- a/core/src/sagittarius/view/ResumeScreen.java +++ b/core/src/sagittarius/view/ResumeScreen.java @@ -28,6 +28,7 @@ public class ResumeScreen extends BaseScreen { SagittariusGame.music.stop(); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/resumeMenu_music.mp3")); SagittariusGame.music.setLooping(true); + SagittariusGame.music.setVolume(SagittariusGame.musicVolume); SagittariusGame.music.play(); } Gdx.input.setInputProcessor(uiStage); @@ -59,6 +60,7 @@ public class ResumeScreen extends BaseScreen { super.tap(event, x, y, count, button); SagittariusGame.music.setVolume(Float.parseFloat(musicVolume.getTextField().getText())); + SagittariusGame.musicVolume = Float.parseFloat(musicVolume.getTextField().getText()); SagittariusGame.soundsVolume = Float.parseFloat(musicSounds.getTextField().getText()); // Deactivate music or not @@ -67,6 +69,7 @@ public class ResumeScreen extends BaseScreen { SagittariusGame.disableMusic = true; } else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){ + SagittariusGame.music.setVolume(SagittariusGame.musicVolume); SagittariusGame.music.play(); SagittariusGame.disableMusic = false; } @@ -94,6 +97,7 @@ public class ResumeScreen extends BaseScreen { SagittariusGame.music.stop(); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/game_music.mp3")); SagittariusGame.music.setLooping(true); + SagittariusGame.music.setVolume(SagittariusGame.musicVolume); SagittariusGame.music.play(); } SagittariusGame.setActiveScreen( gameScreen ); diff --git a/core/src/sagittarius/view/SettingsScreen.java b/core/src/sagittarius/view/SettingsScreen.java index a33d943..d214642 100644 --- a/core/src/sagittarius/view/SettingsScreen.java +++ b/core/src/sagittarius/view/SettingsScreen.java @@ -21,6 +21,7 @@ public class SettingsScreen extends BaseScreen { SagittariusGame.music.stop(); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/resumeMenu_music.mp3")); SagittariusGame.music.setLooping(true); + SagittariusGame.music.setVolume(SagittariusGame.musicVolume); SagittariusGame.music.play(); } @@ -62,6 +63,7 @@ public class SettingsScreen extends BaseScreen { SagittariusGame.G = Float.parseFloat(gConstField.getTextField().getText()); SagittariusGame.music.setVolume(Float.parseFloat(musicVolume.getTextField().getText())); + SagittariusGame.musicVolume= Float.parseFloat(musicVolume.getTextField().getText()); SagittariusGame.soundsVolume = Float.parseFloat(musicSounds.getTextField().getText()); SagittariusGame.debugMode = debugModeBox.isChecked(); @@ -73,6 +75,7 @@ public class SettingsScreen extends BaseScreen { else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){ SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/resumeMenu_music.mp3")); + SagittariusGame.music.setVolume(SagittariusGame.musicVolume); SagittariusGame.music.play(); SagittariusGame.disableMusic = false; } diff --git a/core/src/sagittarius/view/StartScreen.java b/core/src/sagittarius/view/StartScreen.java index 0130806..f3bc572 100644 --- a/core/src/sagittarius/view/StartScreen.java +++ b/core/src/sagittarius/view/StartScreen.java @@ -21,12 +21,15 @@ public class StartScreen extends BaseScreen { SagittariusGame.music.stop(); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/mainMenu_music.mp3")); SagittariusGame.music.setLooping(true); + SagittariusGame.music.setVolume(SagittariusGame.musicVolume); SagittariusGame.music.play(); + } else { SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/mainMenu_music.mp3")); SagittariusGame.music.setLooping(true); + SagittariusGame.music.setVolume(SagittariusGame.musicVolume); SagittariusGame.music.play(); }