summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-07 14:54:36 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-07 14:54:36 +0100
commit406635ee3709e511867e01a05ce24a79ffbe53f7 (patch)
treedc191e82146cf11ecec7da52f8326459696a02a3 /core/src/ch/asynk
parentff3a287ed7663e1e672cb679374b035e9e82e60a (diff)
downloadRustAndDust-406635ee3709e511867e01a05ce24a79ffbe53f7.zip
RustAndDust-406635ee3709e511867e01a05ce24a79ffbe53f7.tar.gz
Map,States: improve API -> hexWhatShow/Hide
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/rustanddust/game/Map.java22
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateBreak.java14
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateDeployment.java16
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateEngage.java6
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateMove.java8
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StatePromote.java2
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java6
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateRotate.java10
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateSelect.java6
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateWithdraw.java2
10 files changed, 46 insertions, 46 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Map.java b/core/src/ch/asynk/rustanddust/game/Map.java
index 7cf52e9..c5e1153 100644
--- a/core/src/ch/asynk/rustanddust/game/Map.java
+++ b/core/src/ch/asynk/rustanddust/game/Map.java
@@ -667,17 +667,17 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS
public void hidePossibleMoves() { possibleMoves.enable(Hex.AREA, false); }
public void showPathBuilder() { pathBuilder.enable(Hex.AREA, true); }
public void hidePathBuilder() { pathBuilder.enable(Hex.AREA, false); }
- public void showPath(Hex dst) { pathBuilder.enable(Hex.MOVE, true); showMove(dst); }
- public void hidePath(Hex dst) { pathBuilder.enable(Hex.MOVE, false); hideMove(dst); }
-
- public void selectHex(Hex hex) { selectedTile.set(hex); }
- public void unselectHex(Hex hex) { selectedTile.hide(); }
- public void showMove(Hex hex) { enableOverlayOn(hex, Hex.MOVE, true); }
- public void hideMove(Hex hex) { enableOverlayOn(hex, Hex.MOVE, false); }
- public void showDirections(Hex hex) { enableOverlayOn(hex, Hex.DIRECTIONS, true); }
- public void hideDirections(Hex hex) { enableOverlayOn(hex, Hex.DIRECTIONS, false); }
- public void showExit(Hex hex) { enableOverlayOn(hex, Hex.EXIT, true); }
- public void hideExit(Hex hex) { enableOverlayOn(hex, Hex.EXIT, false); }
+ public void showPath(Hex dst) { pathBuilder.enable(Hex.MOVE, true); hexMoveShow(dst); }
+ public void hidePath(Hex dst) { pathBuilder.enable(Hex.MOVE, false); hexMoveHide(dst); }
+
+ public void hexSelect(Hex hex) { selectedTile.set(hex); }
+ public void hexUnselect(Hex hex) { selectedTile.hide(); }
+ public void hexMoveShow(Hex hex) { enableOverlayOn(hex, Hex.MOVE, true); }
+ public void hexMoveHide(Hex hex) { enableOverlayOn(hex, Hex.MOVE, false); }
+ public void hexDirectionsShow(Hex hex) { enableOverlayOn(hex, Hex.DIRECTIONS, true); }
+ public void hexDirectionsHide(Hex hex) { enableOverlayOn(hex, Hex.DIRECTIONS, false); }
+ public void hexExitShow(Hex hex) { enableOverlayOn(hex, Hex.EXIT, true); }
+ public void hexExitHide(Hex hex) { enableOverlayOn(hex, Hex.EXIT, false); }
public void showObjective(Hex hex, Army army, boolean hold)
{
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateBreak.java b/core/src/ch/asynk/rustanddust/game/states/StateBreak.java
index 459f640..99dfb63 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateBreak.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateBreak.java
@@ -24,9 +24,9 @@ public class StateBreak extends StateCommon
public void leave(StateType nextState)
{
map.unitsHide(UnitType.BREAK_THROUGH);
- map.hideMove(to);
- map.hideDirections(to);
- if (activeUnit != null) map.hideMove(activeUnit.getHex());
+ map.hexMoveHide(to);
+ map.hexDirectionsHide(to);
+ if (activeUnit != null) map.hexMoveHide(activeUnit.getHex());
}
@Override
@@ -54,9 +54,9 @@ public class StateBreak extends StateCommon
Unit unit = upHex.getUnit();
if (map.unitsContains(UnitType.BREAK_THROUGH, unit)) {
activeUnit = unit;
- map.showMove(upHex);
- map.showMove(to);
- map.showDirections(to);
+ map.hexMoveShow(upHex);
+ map.hexMoveShow(to);
+ map.hexDirectionsShow(to);
map.unitsHide(UnitType.BREAK_THROUGH);
}
} else {
@@ -65,7 +65,7 @@ public class StateBreak extends StateCommon
if (o == Orientation.KEEP) return;
if (ctrl.cfg.mustValidate) {
- map.hideDirections(to);
+ map.hexDirectionsHide(to);
ctrl.hud.actionButtons.show(Buttons.DONE.b);
} else {
doRotation(o);
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java b/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java
index 9528d2a..7d6bb1e 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java
@@ -19,7 +19,7 @@ public class StateDeployment extends StateCommon
public void enter(StateType prevState)
{
if (selectedHex != null)
- map.unselectHex(selectedHex);
+ map.hexUnselect(selectedHex);
completed = false;
entryZone = null;
selectedHex = null;
@@ -33,7 +33,7 @@ public class StateDeployment extends StateCommon
{
selectedUnit = null;
if (selectedHex != null)
- map.unselectHex(selectedHex);
+ map.hexUnselect(selectedHex);
if (entryZone != null)
entryZone.enable(Hex.AREA, false);
ctrl.hud.playerInfo.unitDock.hide();
@@ -89,8 +89,8 @@ public class StateDeployment extends StateCommon
private void undo()
{
- map.unselectHex(selectedHex);
- map.hideDirections(selectedHex);
+ map.hexUnselect(selectedHex);
+ map.hexDirectionsHide(selectedHex);
map.revertEnter(activeUnit);
activeUnit = null;
selectedUnit = null;
@@ -113,16 +113,16 @@ public class StateDeployment extends StateCommon
{
selectedUnit = unit;
selectedHex = hex;
- map.selectHex(selectedHex);
- map.showDirections(selectedHex);
+ map.hexSelect(selectedHex);
+ map.hexDirectionsShow(selectedHex);
ctrl.hud.playerInfo.unitDock.hide();
ctrl.hud.actionButtons.show(Buttons.ABORT.b);
}
private void doRotation(Orientation o)
{
- map.unselectHex(selectedHex);
- map.hideDirections(selectedHex);
+ map.hexUnselect(selectedHex);
+ map.hexDirectionsHide(selectedHex);
if (o != Orientation.KEEP)
map.setOnBoard(selectedUnit, selectedHex, o);
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateEngage.java b/core/src/ch/asynk/rustanddust/game/states/StateEngage.java
index a4be2da..e2e655f 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateEngage.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateEngage.java
@@ -27,7 +27,7 @@ public class StateEngage extends StateCommon
touchUp();
}
selectedUnit.showAttack();
- map.selectHex(selectedHex);
+ map.hexSelect(selectedHex);
} else
RustAndDust.debug("should not happen");
}
@@ -38,9 +38,9 @@ public class StateEngage extends StateCommon
selectedUnit.hideAttack();
map.unitsHide(UnitType.ASSISTS);
map.unitsHide(UnitType.TARGETS);
- map.unselectHex(selectedHex);
+ map.hexUnselect(selectedHex);
if (to != null)
- map.unselectHex(to);
+ map.hexUnselect(to);
}
@Override
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateMove.java b/core/src/ch/asynk/rustanddust/game/states/StateMove.java
index 78dfb40..69f14c4 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateMove.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateMove.java
@@ -56,7 +56,7 @@ public class StateMove extends StateCommon
// hide all but assists : want them when in rotation
activeUnit.hideMoveable();
map.hidePossibleMoves();
- map.unselectHex(activeUnit.getHex());
+ map.hexUnselect(activeUnit.getHex());
if (to != null)
map.hidePath(to);
@@ -136,7 +136,7 @@ public class StateMove extends StateCommon
private void changeUnit(Unit unit)
{
if (activeUnit != null ) {
- map.unselectHex(activeUnit.getHex());
+ map.hexUnselect(activeUnit.getHex());
if (activeUnit.canMove())
activeUnit.enableOverlay(Unit.MOVE, true);
}
@@ -147,7 +147,7 @@ public class StateMove extends StateCommon
map.hidePossibleMoves();
map.collectPossibleMoves(activeUnit);
map.showPossibleMoves();
- map.selectHex(hex);
+ map.hexSelect(hex);
activeUnit.enableOverlay(Unit.MOVE, false);
ctrl.hud.notify(activeUnit.toString());
checkExit(activeUnit, hex);
@@ -159,7 +159,7 @@ public class StateMove extends StateCommon
int s = map.pathBuilder.build(to);
if (s > 1)
s = map.pathBuilder.choosePath();
- map.showMove(to);
+ map.hexMoveShow(to);
map.hidePossibleMoves();
map.showPathBuilder();
return s;
diff --git a/core/src/ch/asynk/rustanddust/game/states/StatePromote.java b/core/src/ch/asynk/rustanddust/game/states/StatePromote.java
index 8543c89..701b856 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StatePromote.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StatePromote.java
@@ -15,7 +15,7 @@ public class StatePromote extends StateCommon
@Override
public void leave(StateType nextState)
{
- map.unselectHex(selectedHex);
+ map.hexUnselect(selectedHex);
}
@Override
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java b/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java
index 77ff826..a4c1bf5 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java
@@ -14,7 +14,7 @@ public class StateReinforcement extends StateCommon
{
map.clearAll();
if (selectedHex != null)
- map.unselectHex(selectedHex);
+ map.hexUnselect(selectedHex);
entryZone = null;
selectedHex = null;
ctrl.hud.playerInfo.unitDock.show();
@@ -24,7 +24,7 @@ public class StateReinforcement extends StateCommon
public void leave(StateType nextState)
{
if (selectedHex != null)
- map.unselectHex(selectedHex);
+ map.hexUnselect(selectedHex);
if (entryZone != null)
entryZone.enable(Hex.AREA, false);
ctrl.hud.playerInfo.unitDock.hide();
@@ -73,7 +73,7 @@ public class StateReinforcement extends StateCommon
{
selectedUnit = unit;
selectedHex = upHex;
- map.selectHex(selectedHex);
+ map.hexSelect(selectedHex);
entryZone.enable(Hex.AREA, false);
if (map.enterBoard(unit, upHex, entryZone.allowedMoves)) {
if (unit.getMovementPoints() > 0)
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateRotate.java b/core/src/ch/asynk/rustanddust/game/states/StateRotate.java
index 4ec9829..b92323b 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateRotate.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateRotate.java
@@ -33,8 +33,8 @@ public class StateRotate extends StateCommon
if (!rotateOnly)
map.showPath(to);
- map.selectHex(activeUnit.getHex());
- map.showDirections(to);
+ map.hexSelect(activeUnit.getHex());
+ map.hexDirectionsShow(to);
rotationSet = false;
}
@@ -42,9 +42,9 @@ public class StateRotate extends StateCommon
@Override
public void leave(StateType nextState)
{
- map.unselectHex(activeUnit.getHex());
+ map.hexUnselect(activeUnit.getHex());
map.hidePath(to);
- map.hideDirections(to);
+ map.hexDirectionsHide(to);
map.pathBuilder.clear();
to = null;
}
@@ -100,7 +100,7 @@ public class StateRotate extends StateCommon
rotationSet = true;
if (ctrl.cfg.mustValidate) {
- map.hideDirections(to);
+ map.hexDirectionsHide(to);
ctrl.hud.actionButtons.show(Buttons.DONE.b | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0));
} else {
execute();
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateSelect.java b/core/src/ch/asynk/rustanddust/game/states/StateSelect.java
index 5844453..21fe844 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateSelect.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateSelect.java
@@ -37,7 +37,7 @@ public class StateSelect extends StateCommon
public StateType abort()
{
if (selectedHex != null)
- map.unselectHex(selectedHex);
+ map.hexUnselect(selectedHex);
hidePossibilities();
map.clearAll();
return StateType.ABORT;
@@ -73,7 +73,7 @@ public class StateSelect extends StateCommon
}
if (selectedHex != null)
- map.unselectHex(selectedHex);
+ map.hexUnselect(selectedHex);
hidePossibilities();
if (upHex.isOffMap()) {
@@ -123,7 +123,7 @@ public class StateSelect extends StateCommon
map.collectMoveableUnits(selectedUnit);
if ((moves > 0) || (targets > 0)) {
- map.selectHex(selectedHex);
+ map.hexSelect(selectedHex);
showPossibilities(selectedUnit);
}
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateWithdraw.java b/core/src/ch/asynk/rustanddust/game/states/StateWithdraw.java
index f4f11a6..e1cfd0e 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateWithdraw.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateWithdraw.java
@@ -62,7 +62,7 @@ public class StateWithdraw extends StateCommon
if (to != null)
map.hidePath(to);
map.hidePossibleMoves();
- map.unselectHex(hex);
+ map.hexUnselect(hex);
if (map.exitBoard(unit) > 0)
return StateType.MOVE;