summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/rustanddust/menu/MenuCtrl.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java b/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java
index 40a75c2..a28b2e7 100644
--- a/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java
+++ b/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java
@@ -70,6 +70,8 @@ public class MenuCtrl implements Disposable, Drawable
public boolean touch(float x, float y)
{
+ MenuType next = MenuType.NONE;
+
if (okCancel.hit(x, y)) {
if (okCancel.ok)
game.playEnter();
@@ -77,11 +79,10 @@ public class MenuCtrl implements Disposable, Drawable
game.playType();
visible = true;
okCancel.visible = false;
- panels[current.i].postAnswer(okCancel.ok);
- return false;
+ return changePanel(panels[current.i].postAnswer(okCancel.ok));
}
- MenuType next = panels[current.i].touch(x, y);
+ next = panels[current.i].touch(x, y);
if (next == MenuType.BEGIN) return true;
@@ -100,10 +101,18 @@ public class MenuCtrl implements Disposable, Drawable
return false;
}
+ return changePanel(next);
+ }
+
+ private boolean changePanel(MenuType next)
+ {
+ if (next == MenuType.BEGIN) return true;
+
if (next != MenuType.NONE) {
while(current != next) {
current = next;
next = panels[next.i].prepare();
+ if (next == MenuType.BEGIN) return true;
}
}