From e297e981cdb8e4136911339f1f99a742eafa4ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 11 Nov 2014 18:23:16 +0100 Subject: Ctrl,Hud: replace changeState(...) with stateTouchUp() and toggleState(...) --- core/src/ch/asynk/tankontank/game/Ctrl.java | 17 ++++++++++++++++- core/src/ch/asynk/tankontank/game/Hud.java | 12 ------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java index 98a5ca2..c42de49 100644 --- a/core/src/ch/asynk/tankontank/game/Ctrl.java +++ b/core/src/ch/asynk/tankontank/game/Ctrl.java @@ -134,6 +134,22 @@ public class Ctrl implements Disposable nextPlayer(); } + public void stateTouchUp() + { + this.state.touchUp(); + } + + public void toggleState(State.StateType stateA, State.StateType stateB) + { + if (this.stateType == stateA) { + setState(stateB); + } else if (this.stateType == stateB) { + setState(stateA); + } else { + TankOnTank.debug("Ctrl", "wrong call to toggleState()"); + } + } + public void setState(State.StateType state) { if (state == State.StateType.ABORT) { @@ -148,7 +164,6 @@ public class Ctrl implements Disposable public void setState(State.StateType state, boolean normal) { - hud.changeState(stateType, state); this.state.leave(state); TankOnTank.debug(" switch to : " + state + " " + normal); diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java index 5087abe..3afd2dc 100644 --- a/core/src/ch/asynk/tankontank/game/Hud.java +++ b/core/src/ch/asynk/tankontank/game/Hud.java @@ -68,18 +68,6 @@ public class Hud implements Disposable stats.dispose(); } - public void changeState(StateType from, StateType to) - { - // if (to != StateType.ENTRY); - // playerInfo.hideUnitDock(); - // TODO when reselect another -> do not hide Dock - - if ((to == StateType.SELECT) || (to == StateType.ENTRY)) - playerInfo.blockReinforcement(false); - else - playerInfo.blockReinforcement(true); - } - public void update() { Position position = ctrl.battle.getHudPosition(ctrl.player); -- cgit v1.1-2-g2b99