résolution de certains bugs (problème la musique du menu de pause prend la place de celle de la game)

This commit is contained in:
heurtet 2021-05-14 00:04:58 +02:00
parent a222e787a7
commit ad4b9ffb99
3 changed files with 23 additions and 14 deletions

View file

@ -48,11 +48,13 @@ public class GameScreen extends BaseScreen implements InputProcessor {
@Override @Override
public void initialize() { public void initialize() {
if (SagittariusGame.music.isPlaying()){ if (!SagittariusGame.disableMusic){
SagittariusGame.music.stop();
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/HMO-MercuryCity.mp3")); SagittariusGame.music.stop();
SagittariusGame.music.setLooping(true); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/HMO-MercuryCity.mp3"));
SagittariusGame.music.play(); SagittariusGame.music.setLooping(true);
SagittariusGame.music.play();
} }
Gdx.input.setInputProcessor(this); Gdx.input.setInputProcessor(this);

View file

@ -24,11 +24,12 @@ public class ResumeScreen extends BaseScreen {
@Override @Override
public void initialize() { public void initialize() {
SagittariusGame.music.stop(); if (!SagittariusGame.disableMusic){
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/Metre - Concentric.mp3")); SagittariusGame.music.stop();
SagittariusGame.music.setLooping(true); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/Metre - Concentric.mp3"));
SagittariusGame.music.play(); SagittariusGame.music.setLooping(true);
SagittariusGame.music.play();
}
Gdx.input.setInputProcessor(uiStage); Gdx.input.setInputProcessor(uiStage);
// Table creation // Table creation
@ -63,10 +64,12 @@ public class ResumeScreen extends BaseScreen {
// Deactivate music or not // Deactivate music or not
if (disableMusic.isChecked() && SagittariusGame.music.isPlaying()){ if (disableMusic.isChecked() && SagittariusGame.music.isPlaying()){
SagittariusGame.music.stop(); SagittariusGame.music.stop();
SagittariusGame.disableMusic = true;
} }
else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){ else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){
SagittariusGame.music.play(); SagittariusGame.music.play();
SagittariusGame.disableMusic = false;
} }
} }

View file

@ -18,10 +18,12 @@ public class SettingsScreen extends BaseScreen {
@Override @Override
public void initialize() { public void initialize() {
SagittariusGame.music.stop(); if (!SagittariusGame.disableMusic){
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/Metre - Concentric.mp3")); SagittariusGame.music.stop();
SagittariusGame.music.setLooping(true); SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/Metre - Concentric.mp3"));
SagittariusGame.music.play(); SagittariusGame.music.setLooping(true);
SagittariusGame.music.play();
}
Gdx.input.setInputProcessor(uiStage); Gdx.input.setInputProcessor(uiStage);
@ -67,10 +69,12 @@ public class SettingsScreen extends BaseScreen {
// Deactivate music or not // Deactivate music or not
if (disableMusic.isChecked() && SagittariusGame.music.isPlaying()){ if (disableMusic.isChecked() && SagittariusGame.music.isPlaying()){
SagittariusGame.music.stop(); SagittariusGame.music.stop();
SagittariusGame.disableMusic = true;
} }
else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){ else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){
SagittariusGame.music.play(); SagittariusGame.music.play();
SagittariusGame.disableMusic = false;
} }
} }