correction bug volume musiques

This commit is contained in:
heurtet 2021-05-14 15:15:02 +02:00
parent 82f8eeb13c
commit 625ddf1ce9
5 changed files with 12 additions and 0 deletions

View file

@ -21,6 +21,7 @@ public class CreditScreen extends BaseScreen {
SagittariusGame.music.stop(); SagittariusGame.music.stop();
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/credit_music.mp3")); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/credit_music.mp3"));
SagittariusGame.music.setLooping(true); SagittariusGame.music.setLooping(true);
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play(); SagittariusGame.music.play();
} }

View file

@ -53,6 +53,7 @@ public class GameScreen extends BaseScreen implements InputProcessor {
SagittariusGame.music.stop(); SagittariusGame.music.stop();
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/game_music.mp3")); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/game_music.mp3"));
SagittariusGame.music.setLooping(true); SagittariusGame.music.setLooping(true);
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play(); SagittariusGame.music.play();
} }

View file

@ -28,6 +28,7 @@ public class ResumeScreen extends BaseScreen {
SagittariusGame.music.stop(); SagittariusGame.music.stop();
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/resumeMenu_music.mp3")); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/resumeMenu_music.mp3"));
SagittariusGame.music.setLooping(true); SagittariusGame.music.setLooping(true);
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play(); SagittariusGame.music.play();
} }
Gdx.input.setInputProcessor(uiStage); Gdx.input.setInputProcessor(uiStage);
@ -59,6 +60,7 @@ public class ResumeScreen extends BaseScreen {
super.tap(event, x, y, count, button); super.tap(event, x, y, count, button);
SagittariusGame.music.setVolume(Float.parseFloat(musicVolume.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.soundsVolume = Float.parseFloat(musicSounds.getTextField().getText());
// Deactivate music or not // Deactivate music or not
@ -67,6 +69,7 @@ public class ResumeScreen extends BaseScreen {
SagittariusGame.disableMusic = true; SagittariusGame.disableMusic = true;
} }
else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){ else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play(); SagittariusGame.music.play();
SagittariusGame.disableMusic = false; SagittariusGame.disableMusic = false;
} }
@ -94,6 +97,7 @@ public class ResumeScreen extends BaseScreen {
SagittariusGame.music.stop(); SagittariusGame.music.stop();
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/game_music.mp3")); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/game_music.mp3"));
SagittariusGame.music.setLooping(true); SagittariusGame.music.setLooping(true);
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play(); SagittariusGame.music.play();
} }
SagittariusGame.setActiveScreen( gameScreen ); SagittariusGame.setActiveScreen( gameScreen );

View file

@ -21,6 +21,7 @@ public class SettingsScreen extends BaseScreen {
SagittariusGame.music.stop(); SagittariusGame.music.stop();
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/resumeMenu_music.mp3")); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/resumeMenu_music.mp3"));
SagittariusGame.music.setLooping(true); SagittariusGame.music.setLooping(true);
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play(); SagittariusGame.music.play();
} }
@ -62,6 +63,7 @@ public class SettingsScreen extends BaseScreen {
SagittariusGame.G = Float.parseFloat(gConstField.getTextField().getText()); SagittariusGame.G = Float.parseFloat(gConstField.getTextField().getText());
SagittariusGame.music.setVolume(Float.parseFloat(musicVolume.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.soundsVolume = Float.parseFloat(musicSounds.getTextField().getText());
SagittariusGame.debugMode = debugModeBox.isChecked(); SagittariusGame.debugMode = debugModeBox.isChecked();
@ -73,6 +75,7 @@ public class SettingsScreen extends BaseScreen {
else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){ else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/resumeMenu_music.mp3")); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/resumeMenu_music.mp3"));
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play(); SagittariusGame.music.play();
SagittariusGame.disableMusic = false; SagittariusGame.disableMusic = false;
} }

View file

@ -21,12 +21,15 @@ public class StartScreen extends BaseScreen {
SagittariusGame.music.stop(); SagittariusGame.music.stop();
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/mainMenu_music.mp3")); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/mainMenu_music.mp3"));
SagittariusGame.music.setLooping(true); SagittariusGame.music.setLooping(true);
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play(); SagittariusGame.music.play();
} }
else { else {
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/mainMenu_music.mp3")); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/mainMenu_music.mp3"));
SagittariusGame.music.setLooping(true); SagittariusGame.music.setLooping(true);
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play(); SagittariusGame.music.play();
} }