summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-26 17:07:51 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-26 17:07:51 +0100
commit0be5282da84214a6948575211e2c36c23591e34d (patch)
treead54ea327e3e1df9c148d4f54169aa288c1cff26 /core
parent0c286976e7b31f5493e7e7c0db9e7f5bb2213b6a (diff)
downloadRustAndDust-0be5282da84214a6948575211e2c36c23591e34d.zip
RustAndDust-0be5282da84214a6948575211e2c36c23591e34d.tar.gz
Hud: get ready to fix dialogAction bug
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index a5dfe0a..a12fd14 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -67,6 +67,7 @@ public class Hud implements Disposable
stats = new Statistics(font, atlas.findRegion("disabled"), atlas, 10f);
engagement = new Engagement(font, atlas.findRegion("disabled"), atlas, 10f);
dialogs = new Widget[] { okCancel, stats, engagement};
+ dialogAction = DialogAction.NONE;
}
@Override
@@ -215,47 +216,55 @@ public class Hud implements Disposable
}
okCancel.visible = false;
ctrl.blockMap = false;
+ dialogAction = DialogAction.NONE;
+ }
+
+ private void setDialogAction(DialogAction action)
+ {
+ if (dialogAction != DialogAction.NONE)
+ System.err.println(":::: BUG :::: dialogAction is already set to " + dialogAction);
+ dialogAction = action;
}
public void notifyEndOfTurn()
{
ctrl.blockMap = true;
- dialogAction = DialogAction.END_TURN;
+ setDialogAction(DialogAction.END_TURN);
okCancel.show("You have no more Action Points left.", Position.MIDDLE_CENTER, false);
}
public void askExitBoard()
{
ctrl.blockMap = true;
- dialogAction = DialogAction.EXIT_BOARD;
+ setDialogAction(DialogAction.EXIT_BOARD);
okCancel.show("Do you want this unit to escape the battle fierd ?", Position.MIDDLE_CENTER);
}
public void askEndOfTurn()
{
ctrl.blockMap = true;
- dialogAction = DialogAction.ABORT_TURN;
+ setDialogAction(DialogAction.ABORT_TURN);
okCancel.show("You still have Action Points left.\nEnd your Turn anyway ?", Position.MIDDLE_CENTER);
}
public void askEndDeployment()
{
ctrl.blockMap = true;
- dialogAction = DialogAction.END_DEPLOYMENT;
+ setDialogAction(DialogAction.END_DEPLOYMENT);
okCancel.show("Deployment unit count reached.\nEnd Deployment phase ?", Position.MIDDLE_CENTER);
}
public void engagementSummary(int d1, int d2, int cnt, int flk, int def, int tdf, int wdf, String msg)
{
ctrl.blockMap = true;
- dialogAction = DialogAction.END_ENGAGEMENT;
+ setDialogAction(DialogAction.END_ENGAGEMENT);
engagement.show(d1, d2, cnt, flk, def, tdf, wdf, msg, Position.BOTTOM_CENTER);
}
public void victory(Player winner, Player loser)
{
ctrl.blockMap = true;
- dialogAction = DialogAction.END_GAME;
+ setDialogAction(DialogAction.END_GAME);
stats.show(winner, loser, Position.MIDDLE_CENTER);
}
}