summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-27 15:36:39 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-27 15:36:39 +0100
commitea89006b40d024886deb280ec51268eb5507b904 (patch)
treee80b8115aed8513dd78176cc3c778439f52b75f9 /core
parent655e19401debae60e029a4ceca41caeb52a80ad3 (diff)
downloadRustAndDust-ea89006b40d024886deb280ec51268eb5507b904.zip
RustAndDust-ea89006b40d024886deb280ec51268eb5507b904.tar.gz
Hud: simplify touchUp() code
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java35
1 files changed, 17 insertions, 18 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index 9220925..da3c31c 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -163,26 +163,25 @@ public class Hud implements Disposable
if (hit == null)
return false;
- if (hit == actionButtons) {
- actionButtons.touchUp(x, y);
- }
- else if (hit == playerInfo) {
- playerInfo.touchUp(x, y);
- }
- else if (hit == okCancel) {
- if (okCancel.hit(x, y))
- closeDialog();
- }
- else if (hit == stats) {
- if (stats.hit(x, y))
- closeDialog();
- }
- else if (hit == engagement) {
- if (engagement.hit(x, y))
- closeDialog();
+ for (Widget w : dialogs) {
+ if (hit == w) {
+ if (w.hit(x, y))
+ closeDialog();
+ hit = null;
+ break;
+ }
}
- hit = null;
+ if (hit != null) {
+ if (hit == actionButtons) {
+ actionButtons.touchUp(x, y);
+ }
+ else if (hit == playerInfo) {
+ playerInfo.touchUp(x, y);
+ }
+
+ hit = null;
+ }
return true;
}