diff options
Diffstat (limited to 'core/src/ch/asynk/tankontank')
8 files changed, 132 insertions, 132 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/StateAnimation.java b/core/src/ch/asynk/tankontank/game/states/StateAnimation.java index 8690e9c..86bf61c 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateAnimation.java +++ b/core/src/ch/asynk/tankontank/game/states/StateAnimation.java @@ -14,24 +14,24 @@ public class StateAnimation extends StateCommon } @Override - public void touchDown() + public StateType abort() { + return StateType.ABORT; } @Override - public void touchUp() + public StateType done() { + return StateType.DONE; } @Override - public StateType abort() + public void touchDown() { - return StateType.ABORT; } @Override - public StateType done() + public void touchUp() { - return StateType.DONE; } } diff --git a/core/src/ch/asynk/tankontank/game/states/StateAttack.java b/core/src/ch/asynk/tankontank/game/states/StateAttack.java index 37df9f7..97efd87 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateAttack.java +++ b/core/src/ch/asynk/tankontank/game/states/StateAttack.java @@ -44,36 +44,6 @@ public class StateAttack extends StateCommon } @Override - public void touchDown() - { - } - - @Override - public void touchUp() - { - Unit unit = upHex.getUnit(); - - // activeUnit is the target - if ((activeUnit == null) && map.possibleTargets.contains(unit)) { - ctrl.hud.notify("Attack " + unit); - map.hidePossibleTargets(); - to = upHex; - activeUnit = unit; - activeUnit.showTarget(); - map.collectAttackAssists(selectedUnit, activeUnit, ctrl.player.unitIterator()); - map.showAttackAssists(); - ctrl.hud.actionButtons.show(Buttons.ATTACK.b | Buttons.DONE.b | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0)); - } - - if ((activeUnit != null) && map.attackAssists.contains(unit)) { - if(map.toggleAttackAssist(unit)) - ctrl.hud.notify(unit + " will fire"); - else - ctrl.hud.notify(unit + " wont fire"); - } - } - - @Override public StateType abort() { map.activatedPawns.clear(); @@ -104,4 +74,34 @@ public class StateAttack extends StateCommon return nextState; } + + @Override + public void touchDown() + { + } + + @Override + public void touchUp() + { + Unit unit = upHex.getUnit(); + + // activeUnit is the target + if ((activeUnit == null) && map.possibleTargets.contains(unit)) { + ctrl.hud.notify("Attack " + unit); + map.hidePossibleTargets(); + to = upHex; + activeUnit = unit; + activeUnit.showTarget(); + map.collectAttackAssists(selectedUnit, activeUnit, ctrl.player.unitIterator()); + map.showAttackAssists(); + ctrl.hud.actionButtons.show(Buttons.ATTACK.b | Buttons.DONE.b | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0)); + } + + if ((activeUnit != null) && map.attackAssists.contains(unit)) { + if(map.toggleAttackAssist(unit)) + ctrl.hud.notify(unit + " will fire"); + else + ctrl.hud.notify(unit + " wont fire"); + } + } } diff --git a/core/src/ch/asynk/tankontank/game/states/StateBreak.java b/core/src/ch/asynk/tankontank/game/states/StateBreak.java index debc9c1..a64a494 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateBreak.java +++ b/core/src/ch/asynk/tankontank/game/states/StateBreak.java @@ -31,6 +31,19 @@ public class StateBreak extends StateCommon } @Override + public StateType abort() + { + return StateType.ABORT; + } + + @Override + public StateType done() + { + doRotation(o); + return StateType.DONE; + } + + @Override public void touchDown() { } @@ -61,19 +74,6 @@ public class StateBreak extends StateCommon } } - @Override - public StateType abort() - { - return StateType.ABORT; - } - - @Override - public StateType done() - { - doRotation(o); - return StateType.DONE; - } - private void doRotation(Orientation o) { if (done || (activeUnit == null)) return; diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java index 02f814e..fbc71ea 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java @@ -53,6 +53,30 @@ public class StateMove extends StateCommon } @Override + public StateType abort() + { + hideAssists(); + ctrl.setAnimationCount(map.activatedPawns.size()); + map.revertMoves(); + if (activeUnit.move.entryMove) { + map.leaveBoard(activeUnit); + ctrl.player.revertUnitEntry(activeUnit); + } + return StateType.ABORT; + } + + @Override + public StateType done() + { + hideAssists(); + // be sure that the hq is activated + if (selectedUnit.canMove() && (map.activatedPawns.size() > 0)) { + selectedUnit.move(); + } + return StateType.DONE; + } + + @Override public void touchDown() { } @@ -78,30 +102,6 @@ public class StateMove extends StateCommon } } - @Override - public StateType abort() - { - hideAssists(); - ctrl.setAnimationCount(map.activatedPawns.size()); - map.revertMoves(); - if (activeUnit.move.entryMove) { - map.leaveBoard(activeUnit); - ctrl.player.revertUnitEntry(activeUnit); - } - return StateType.ABORT; - } - - @Override - public StateType done() - { - hideAssists(); - // be sure that the hq is activated - if (selectedUnit.canMove() && (map.activatedPawns.size() > 0)) { - selectedUnit.move(); - } - return StateType.DONE; - } - private void hideAssists() { map.hideMoveablePawns(); diff --git a/core/src/ch/asynk/tankontank/game/states/StatePromote.java b/core/src/ch/asynk/tankontank/game/states/StatePromote.java index 49bcad5..70cb875 100644 --- a/core/src/ch/asynk/tankontank/game/states/StatePromote.java +++ b/core/src/ch/asynk/tankontank/game/states/StatePromote.java @@ -22,24 +22,24 @@ public class StatePromote extends StateCommon } @Override - public void touchDown() + public StateType abort() { + return StateType.ABORT; } @Override - public void touchUp() + public StateType done() { + return StateType.DONE; } @Override - public StateType abort() + public void touchDown() { - return StateType.ABORT; } @Override - public StateType done() + public void touchUp() { - return StateType.DONE; } } diff --git a/core/src/ch/asynk/tankontank/game/states/StateReinforcement.java b/core/src/ch/asynk/tankontank/game/states/StateReinforcement.java index 5a611f9..2c423c6 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateReinforcement.java +++ b/core/src/ch/asynk/tankontank/game/states/StateReinforcement.java @@ -31,6 +31,18 @@ public class StateReinforcement extends StateCommon } @Override + public StateType abort() + { + return StateType.ABORT; + } + + @Override + public StateType done() + { + return StateType.DONE; + } + + @Override public void touchDown() { } @@ -47,18 +59,6 @@ public class StateReinforcement extends StateCommon ctrl.setState(StateType.SELECT); } - @Override - public StateType abort() - { - return StateType.ABORT; - } - - @Override - public StateType done() - { - return StateType.DONE; - } - private void changeUnit(Unit unit) { activeUnit = unit; diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java index 7390b0d..2066a8a 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java @@ -43,31 +43,6 @@ public class StateRotate extends StateCommon } @Override - public void touchDown() - { - } - - @Override - public void touchUp() - { - if (rotationSet) return; - - o = Orientation.fromAdj(to.getCol(), to.getRow(), downHex.getCol(), downHex.getRow()); - - if (o == Orientation.KEEP) return; - if (!activeUnit.move.entryMove && rotateOnly && (o == activeUnit.getOrientation())) return; - rotationSet = true; - - - if (ctrl.cfg.mustValidate) { - map.hideDirections(to); - map.showOrientation(to, o); - ctrl.hud.actionButtons.show(Buttons.ROTATE.b | Buttons.DONE.b | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0)); - } else - doRotation(o); - } - - @Override public StateType abort() { StateType nextState = StateType.ABORT; @@ -93,6 +68,31 @@ public class StateRotate extends StateCommon return StateType.DONE; } + @Override + public void touchDown() + { + } + + @Override + public void touchUp() + { + if (rotationSet) return; + + o = Orientation.fromAdj(to.getCol(), to.getRow(), downHex.getCol(), downHex.getRow()); + + if (o == Orientation.KEEP) return; + if (!activeUnit.move.entryMove && rotateOnly && (o == activeUnit.getOrientation())) return; + rotationSet = true; + + + if (ctrl.cfg.mustValidate) { + map.hideDirections(to); + map.showOrientation(to, o); + ctrl.hud.actionButtons.show(Buttons.ROTATE.b | Buttons.DONE.b | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0)); + } else + doRotation(o); + } + private void hideAssists() { map.hideMoveablePawns(); diff --git a/core/src/ch/asynk/tankontank/game/states/StateSelect.java b/core/src/ch/asynk/tankontank/game/states/StateSelect.java index e8b9539..82733fb 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/StateSelect.java @@ -29,6 +29,22 @@ public class StateSelect extends StateCommon } @Override + public StateType abort() + { + if (selectedHex != null) + map.unselectHex(selectedHex); + hidePossibilities(); + map.clearAll(); + return StateType.ABORT; + } + + @Override + public StateType done() + { + return StateType.DONE; + } + + @Override public void touchDown() { if (selectedHex != null) @@ -79,20 +95,4 @@ public class StateSelect extends StateCommon } if (selectedUnit != null) ctrl.hud.notify(selectedUnit.toString()); } - - @Override - public StateType abort() - { - if (selectedHex != null) - map.unselectHex(selectedHex); - hidePossibilities(); - map.clearAll(); - return StateType.ABORT; - } - - @Override - public StateType done() - { - return StateType.DONE; - } } |