summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game/hud
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-27 16:34:36 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-27 16:34:36 +0100
commit78c2768388dfeaf7da10168c0cafdc77e4c3f247 (patch)
tree065145a6618d741ce0ec95740b5bd8cbc65929b3 /core/src/ch/asynk/tankontank/game/hud
parentc65ee999c4377c0a6d6f5826c3b8b52b1d7ed670 (diff)
downloadRustAndDust-78c2768388dfeaf7da10168c0cafdc77e4c3f247.zip
RustAndDust-78c2768388dfeaf7da10168c0cafdc77e4c3f247.tar.gz
Hud,Ctrl,OkCancel: Hud stacks dialogs
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/hud')
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/OkCancel.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/core/src/ch/asynk/tankontank/game/hud/OkCancel.java b/core/src/ch/asynk/tankontank/game/hud/OkCancel.java
index 56c3e96..472d066 100644
--- a/core/src/ch/asynk/tankontank/game/hud/OkCancel.java
+++ b/core/src/ch/asynk/tankontank/game/hud/OkCancel.java
@@ -13,6 +13,15 @@ public class OkCancel extends Bg
protected Label label;
protected Bg okBtn;
protected Bg cancelBtn;
+ public Action action;
+
+ public enum Action
+ {
+ EXIT_BOARD,
+ ABORT_TURN,
+ END_TURN,
+ END_DEPLOYMENT,
+ }
public OkCancel(BitmapFont font, TextureRegion region, TextureAtlas atlas, float padding)
{
@@ -24,13 +33,15 @@ public class OkCancel extends Bg
this.padding = padding;
}
- public void show(String msg, Position position)
+ public void show(String msg, Action action)
{
- show(msg, position, true);
+ show(msg, action, Position.MIDDLE_CENTER);
}
- public void show(String msg, Position position, boolean canCancel)
+ public void show(String msg, Action action, Position position)
{
+ this.action = action;
+
label.write(msg);
float height = (label.getHeight() + (4 * padding) + okBtn.getHeight());
@@ -46,7 +57,11 @@ public class OkCancel extends Bg
label.setPosition((x + padding), (y + okBtn.getHeight() + (2 * padding)));
visible = true;
ok = false;
- cancelBtn.visible = canCancel;
+ }
+
+ public void noCancel()
+ {
+ cancelBtn.visible = false;
}
public boolean hit(float x, float y)