summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-04-04 20:27:33 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-04-04 20:27:33 +0200
commit16d5333e84dc0a2f981252d49f5cc87c82f513e2 (patch)
tree3258ae703d8c35d30c04b04fe9cda27b4428183c /core/src/ch/asynk/rustanddust
parentb4ad4255e646b1d5d6dcbb7d22fdb987983b700d (diff)
downloadRustAndDust-16d5333e84dc0a2f981252d49f5cc87c82f513e2.zip
RustAndDust-16d5333e84dc0a2f981252d49f5cc87c82f513e2.tar.gz
Hud: only play sound if toggle option panel happens
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r--core/src/ch/asynk/rustanddust/game/Hud.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Hud.java b/core/src/ch/asynk/rustanddust/game/Hud.java
index 1262a80..01323f8 100644
--- a/core/src/ch/asynk/rustanddust/game/Hud.java
+++ b/core/src/ch/asynk/rustanddust/game/Hud.java
@@ -184,8 +184,8 @@ public class Hud implements Disposable, Animation
public boolean hit(float x, float y, boolean isInAnimation)
{
if (optionsBtn.hit(x, y)) {
- game.playType();
- toggleOptionsPanel();
+ if (toggleOptionsPanel())
+ game.playType();
return true;
}
@@ -260,17 +260,18 @@ public class Hud implements Disposable, Animation
dialogs.push(dialog);
}
- private void toggleOptionsPanel()
+ private boolean toggleOptionsPanel()
{
if (dialogs.size() > 0) {
- if (dialogs.peek() == optionsPanel) {
- optionsPanel.close();
- closeDialog();
- }
+ if (dialogs.peek() != optionsPanel)
+ return false;
+ optionsPanel.close();
+ closeDialog();
} else {
optionsPanel.show();
pushDialog(optionsPanel);
}
+ return true;
}
public void askExitBoard()