From be736b3a1c31eed88711dc1ae750e9bfdd1f3e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 31 Mar 2016 20:13:15 +0200 Subject: Ctrl: add EventType.TOGGLE_REINFORCEMENT --- core/src/ch/asynk/rustanddust/game/Ctrl.java | 8 ++++++-- core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 53945c7..bbdc8df 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -34,7 +34,8 @@ public abstract class Ctrl implements Disposable { STATE_CHANGE, HUD_ANSWER, - ANIMATIONS_DONE; + ANIMATIONS_DONE, + TOGGLE_REINFORCEMENT; } class Event @@ -216,6 +217,9 @@ public abstract class Ctrl implements Disposable case ANIMATIONS_DONE: animationsDone(); break; + case TOGGLE_REINFORCEMENT: + toggleReinforcement(); + break; default: RustAndDust.error(String.format("Unhandled Event Type : %s %s", evt.type, evt.data)); } @@ -323,7 +327,7 @@ public abstract class Ctrl implements Disposable state.touch(null); } - public void reinforcementHit() + private void toggleReinforcement() { if (this.stateType == StateType.SELECT) setState(StateType.REINFORCEMENT); diff --git a/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java b/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java index ef05187..2719a87 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java +++ b/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java @@ -141,7 +141,7 @@ public class PlayerInfo implements Disposable, Drawable, Animation return true; } else if (reinforcement.hit(x, y)) { - ctrl.reinforcementHit(); + ctrl.postEvent(Ctrl.EventType.TOGGLE_REINFORCEMENT); return true; } else if (unitDock.hit(x, y)) { -- cgit v1.1-2-g2b99