From ad4b9ffb99d7a469163d4b0700474eba3940b2a4 Mon Sep 17 00:00:00 2001 From: heurtet Date: Fri, 14 May 2021 00:04:58 +0200 Subject: [PATCH] =?UTF-8?q?=20r=C3=A9solution=20de=20certains=20bugs=20(pr?= =?UTF-8?q?obl=C3=A8me=20la=20musique=20du=20menu=20de=20pause=20prend=20l?= =?UTF-8?q?a=20place=20de=20celle=20de=20la=20game)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/sagittarius/view/GameScreen.java | 12 +++++++----- core/src/sagittarius/view/ResumeScreen.java | 13 ++++++++----- core/src/sagittarius/view/SettingsScreen.java | 12 ++++++++---- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/core/src/sagittarius/view/GameScreen.java b/core/src/sagittarius/view/GameScreen.java index 2d0c5bc..0cde633 100644 --- a/core/src/sagittarius/view/GameScreen.java +++ b/core/src/sagittarius/view/GameScreen.java @@ -48,11 +48,13 @@ public class GameScreen extends BaseScreen implements InputProcessor { @Override public void initialize() { - if (SagittariusGame.music.isPlaying()){ - SagittariusGame.music.stop(); - SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/HMO-MercuryCity.mp3")); - SagittariusGame.music.setLooping(true); - SagittariusGame.music.play(); + if (!SagittariusGame.disableMusic){ + + SagittariusGame.music.stop(); + SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/HMO-MercuryCity.mp3")); + SagittariusGame.music.setLooping(true); + SagittariusGame.music.play(); + } Gdx.input.setInputProcessor(this); diff --git a/core/src/sagittarius/view/ResumeScreen.java b/core/src/sagittarius/view/ResumeScreen.java index 8cb0606..3f88f68 100644 --- a/core/src/sagittarius/view/ResumeScreen.java +++ b/core/src/sagittarius/view/ResumeScreen.java @@ -24,11 +24,12 @@ public class ResumeScreen extends BaseScreen { @Override public void initialize() { - SagittariusGame.music.stop(); - SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/Metre - Concentric.mp3")); - SagittariusGame.music.setLooping(true); - SagittariusGame.music.play(); - + if (!SagittariusGame.disableMusic){ + SagittariusGame.music.stop(); + SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/Metre - Concentric.mp3")); + SagittariusGame.music.setLooping(true); + SagittariusGame.music.play(); + } Gdx.input.setInputProcessor(uiStage); // Table creation @@ -63,10 +64,12 @@ public class ResumeScreen extends BaseScreen { // Deactivate music or not if (disableMusic.isChecked() && SagittariusGame.music.isPlaying()){ SagittariusGame.music.stop(); + SagittariusGame.disableMusic = true; } else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){ SagittariusGame.music.play(); + SagittariusGame.disableMusic = false; } } diff --git a/core/src/sagittarius/view/SettingsScreen.java b/core/src/sagittarius/view/SettingsScreen.java index b373568..1b71414 100644 --- a/core/src/sagittarius/view/SettingsScreen.java +++ b/core/src/sagittarius/view/SettingsScreen.java @@ -18,10 +18,12 @@ public class SettingsScreen extends BaseScreen { @Override public void initialize() { - SagittariusGame.music.stop(); - SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/Metre - Concentric.mp3")); - SagittariusGame.music.setLooping(true); - SagittariusGame.music.play(); + if (!SagittariusGame.disableMusic){ + SagittariusGame.music.stop(); + SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/Metre - Concentric.mp3")); + SagittariusGame.music.setLooping(true); + SagittariusGame.music.play(); + } Gdx.input.setInputProcessor(uiStage); @@ -67,10 +69,12 @@ public class SettingsScreen extends BaseScreen { // Deactivate music or not if (disableMusic.isChecked() && SagittariusGame.music.isPlaying()){ SagittariusGame.music.stop(); + SagittariusGame.disableMusic = true; } else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){ SagittariusGame.music.play(); + SagittariusGame.disableMusic = false; } }