summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java28
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java29
2 files changed, 31 insertions, 26 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index 3afd2dc..f39a1e7 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -119,18 +119,16 @@ public class Hud implements Disposable
{
hit = null;
- if (playerInfo.touchDown(x, y))
- hit = playerInfo;
- else if (actionButtons.touchDown(x, y))
+ if (actionButtons.touchDown(x, y))
hit = actionButtons;
+ else if (playerInfo.touchDown(x, y))
+ hit = playerInfo;
else if (okCancel.hit(x, y))
hit = okCancel;
else if (stats.hit(x, y))
hit = stats;
- else
- return false;
- return true;
+ return (hit != null);
}
public boolean touchUp(float x, float y)
@@ -138,14 +136,20 @@ public class Hud implements Disposable
if (hit == null)
return false;
- if (hit == actionButtons)
+ if (hit == actionButtons) {
actionButtons.touchUp(x, y);
- else if (hit == playerInfo)
+ }
+ else if (hit == playerInfo) {
playerInfo.touchUp(x, y);
- else if ((hit == okCancel) && okCancel.hit(x, y))
- closeDialog();
- else if ((hit == stats) && stats.hit(x, y))
- closeDialog();
+ }
+ else if (hit == okCancel) {
+ if (okCancel.hit(x, y))
+ closeDialog();
+ }
+ else if (hit == stats) {
+ if (stats.hit(x, y))
+ closeDialog();
+ }
hit = null;
diff --git a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java
index bb4ad93..7e751bf 100644
--- a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java
+++ b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java
@@ -135,15 +135,10 @@ public class PlayerInfo implements Disposable, Drawable
hit = reinforcement;
else if (unitDock.hit(x, y))
hit = unitDock;
- else {
- hideUnitDock();
- if (turns.hit(x,y))
- hit = turns;
- else
- return false;
- }
+ else if (turns.hit(x,y))
+ hit = turns;
- return true;
+ return (hit != null);
}
public boolean touchUp(float x, float y)
@@ -151,12 +146,18 @@ public class PlayerInfo implements Disposable, Drawable
if (hit == null)
return false;
- if ((hit == turns) && turns.hit(x, y))
- ctrl.hud.askEndTurn();
- else if ((hit == reinforcement) && reinforcement.hit(x, y))
- unitDock.toggle();
- else if ((hit == unitDock) && unitDock.hit(x, y))
- ctrl.setState(StateType.ENTRY);
+ if (hit == turns) {
+ if (turns.hit(x, y))
+ ctrl.hud.askEndTurn();
+ }
+ else if (hit == reinforcement) {
+ if (reinforcement.hit(x, y))
+ ctrl.toggleState(StateType.ENTRY, StateType.SELECT);
+ }
+ else if (hit == unitDock) {
+ if (unitDock.hit(x, y))
+ ctrl.stateTouchUp();
+ }
hit = null;