diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-30 16:26:05 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-30 16:26:05 +0200 |
commit | c18b9dd53947581a2ae5a91c72c9a8287ed894ef (patch) | |
tree | f397689a2c26e4db27f10bd589eb2cde9f0c7a27 /core/src | |
parent | b2f2b47a7ca6635cb6fe1f2dfc78df8a8f51e55b (diff) | |
download | RustAndDust-c18b9dd53947581a2ae5a91c72c9a8287ed894ef.zip RustAndDust-c18b9dd53947581a2ae5a91c72c9a8287ed894ef.tar.gz |
State: use ctrl.post(StateType) instead of ctrl.setState(StateType)
Diffstat (limited to 'core/src')
9 files changed, 21 insertions, 21 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateBreak.java b/core/src/ch/asynk/rustanddust/game/states/StateBreak.java index 749265b..1dab40b 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateBreak.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateBreak.java @@ -58,7 +58,7 @@ public class StateBreak extends StateCommon if (o == Orientation.KEEP) return; doRotation(o); - ctrl.setState(StateType.ANIMATION); + ctrl.post(StateType.ANIMATION); } } diff --git a/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java b/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java index 34bb53d..f967917 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java @@ -123,6 +123,6 @@ public class StateDeployment extends StateCommon map.hexDirectionsHide(selectedHex); ctrl.hud.actionButtons.hide(); ctrl.hud.playerInfo.unitDock.show(); - ctrl.setState(StateType.DONE); + ctrl.post(StateType.DONE); } } diff --git a/core/src/ch/asynk/rustanddust/game/states/StateEngage.java b/core/src/ch/asynk/rustanddust/game/states/StateEngage.java index 56e0fd2..17c28f0 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateEngage.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateEngage.java @@ -66,7 +66,7 @@ public class StateEngage extends StateCommon // activeUnit is the target, selectedTarget is the engagement leader if (unit == selectedUnit) { - ctrl.setState(StateType.ABORT); + ctrl.post(StateType.ABORT); } else if ((activeUnit == null) && map.unitsTargetContains(unit)) { // ctrl.hud.notify("Engage " + unit); map.unitsTargetHide(); @@ -77,7 +77,7 @@ public class StateEngage extends StateCommon map.unitsAssistShow(); } else if (unit == activeUnit) { - ctrl.setState(StateType.DONE); + ctrl.post(StateType.DONE); } else if ((activeUnit != null) && map.unitsActivableContains(unit)) { map.toggleAssist(unit); diff --git a/core/src/ch/asynk/rustanddust/game/states/StateMove.java b/core/src/ch/asynk/rustanddust/game/states/StateMove.java index 9a784de..3aa684d 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateMove.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateMove.java @@ -97,7 +97,7 @@ public class StateMove extends StateCommon map.pathHide(to); to = null; map.pathsClear(); - ctrl.setState(StateType.ROTATE); + ctrl.post(StateType.ROTATE); return; } @@ -156,7 +156,7 @@ public class StateMove extends StateCommon s = map.pathsChooseBest(); map.pathsShow(); if (s == 1) - ctrl.setState(StateType.ROTATE); + ctrl.post(StateType.ROTATE); } private void togglePoint(Hex hex, int s) @@ -173,7 +173,7 @@ public class StateMove extends StateCommon if (s == 1) { if (!checkExit(activeUnit, hex)) - ctrl.setState(StateType.ROTATE); + ctrl.post(StateType.ROTATE); } } @@ -183,7 +183,7 @@ public class StateMove extends StateCommon return false; if ((unit.exitZone == null) || !unit.exitZone.contains(unit.getHex())) return false; - ctrl.setState(StateType.WITHDRAW); + ctrl.post(StateType.WITHDRAW); return true; } @@ -193,7 +193,7 @@ public class StateMove extends StateCommon return false; if (!map.pathsCanExit(unit.exitZone.orientation)) return false; - ctrl.setState(StateType.WITHDRAW); + ctrl.post(StateType.WITHDRAW); return true; } } diff --git a/core/src/ch/asynk/rustanddust/game/states/StatePromote.java b/core/src/ch/asynk/rustanddust/game/states/StatePromote.java index bd249d1..bfec208 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StatePromote.java +++ b/core/src/ch/asynk/rustanddust/game/states/StatePromote.java @@ -6,7 +6,7 @@ public class StatePromote extends StateCommon public void enterFrom(StateType prevState) { ctrl.setAfterAnimationState(StateType.DONE); - ctrl.setState(StateType.ANIMATION); + ctrl.post(StateType.ANIMATION); map.promoteUnit(selectedUnit); } diff --git a/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java b/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java index c0b3d4c..e118924 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java @@ -50,7 +50,7 @@ public class StateReinforcement extends StateCommon else if ((entryZone != null) && hex.isEmpty() && entryZone.contains(hex)) unitEnter(activeUnit, hex); else - ctrl.setState(StateType.SELECT); + ctrl.post(StateType.SELECT); } private void changeUnit(Unit unit) @@ -70,9 +70,9 @@ public class StateReinforcement extends StateCommon entryZone.enable(Hex.AREA, false); if (map.enterBoard(unit, hex, entryZone.allowedMoves)) { if (unit.getMovementPoints() > 0) - ctrl.setState(StateType.MOVE); + ctrl.post(StateType.MOVE); else - ctrl.setState(StateType.ROTATE); + ctrl.post(StateType.ROTATE); } else { ctrl.hud.notify("Can not enter the map at that position"); } diff --git a/core/src/ch/asynk/rustanddust/game/states/StateReplay.java b/core/src/ch/asynk/rustanddust/game/states/StateReplay.java index fff29e8..2115748 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateReplay.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateReplay.java @@ -13,13 +13,13 @@ public class StateReplay extends StateCommon if (o == null) { StateType nextState = nextState(); order = null; - ctrl.setState(nextState); + ctrl.post(nextState); } else { this.order = o; setup(); map.replay(order); ctrl.setAfterAnimationState(StateType.REPLAY); - ctrl.setState(StateType.ANIMATION); + ctrl.post(StateType.ANIMATION); } } diff --git a/core/src/ch/asynk/rustanddust/game/states/StateRotate.java b/core/src/ch/asynk/rustanddust/game/states/StateRotate.java index a2a8af7..4aa9608 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateRotate.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateRotate.java @@ -88,7 +88,7 @@ public class StateRotate extends StateCommon Orientation o = Orientation.fromAdj(to, hex); if (o == Orientation.KEEP) { - ctrl.setState(StateType.ABORT); + ctrl.post(StateType.ABORT); return; } @@ -98,6 +98,6 @@ public class StateRotate extends StateCommon map.pathsSetOrientation(o); rotationSet = true; execute(); - ctrl.setState(StateType.ANIMATION); + ctrl.post(StateType.ANIMATION); } } diff --git a/core/src/ch/asynk/rustanddust/game/states/StateSelect.java b/core/src/ch/asynk/rustanddust/game/states/StateSelect.java index a3c563a..518258f 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateSelect.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateSelect.java @@ -48,13 +48,13 @@ public class StateSelect extends StateCommon if (map.movesContains(hex)) { // quick move to = hex; - ctrl.setState(StateType.MOVE); + ctrl.post(StateType.MOVE); return; } if (map.unitsTargetContains(hex.getUnit())) { // quick fire to = hex; - ctrl.setState(StateType.ENGAGE); + ctrl.post(StateType.ENGAGE); return; } } @@ -83,11 +83,11 @@ public class StateSelect extends StateCommon if (unit.isHq() && (map.unitsActivableSize() > 1)) { ctrl.hud.notify("HQ activation"); select(hex, unit, isEnemy); - ctrl.setState(StateType.MOVE); + ctrl.post(StateType.MOVE); } else { // quick rotate to = hex; - ctrl.setState(StateType.ROTATE); + ctrl.post(StateType.ROTATE); } } else { select(hex, unit, isEnemy); |