Created enums and bound them to zoom in, zoom out and sails toggle for key bindings so that something expected shows up for key binding descriptions when changing key bindings. #story[1197]

This commit is contained in:
David Wu
2017-09-14 16:23:56 +12:00
parent 4cb0948aaf
commit 43ee92fb95
8 changed files with 18 additions and 11 deletions
@@ -29,12 +29,14 @@ public class CommandFactory {
}
switch(action.getBoatAction()) {
case AUTO_PILOT: return new VMGCommand(race, boat);
case VMG: return new VMGCommand(race, boat);
case TACK_GYBE: return new TackGybeCommand(race, boat);
case UPWIND: return new WindCommand(race, boat, true);
case DOWNWIND: return new WindCommand(race, boat, false);
case SAILS_OUT: return new SailsCommand(race, boat, true);
case SAILS_IN: return new SailsCommand(race, boat, false);
case ZOOM_IN: return null;
case ZOOM_OUT: return null;
default: throw new CommandConstructionException("Could not create command for BoatAction: " + action + ". Unknown BoatAction.");
}
@@ -12,12 +12,15 @@ public enum BoatActionEnum {
/**
* Autopilot = auto VMG.
*/
AUTO_PILOT(1),
VMG(1),
SAILS_IN(2),
SAILS_OUT(3),
TACK_GYBE(4),
UPWIND(5),
DOWNWIND(6);
DOWNWIND(6),
ZOOM_IN(7),
ZOOM_OUT(8),
TOGGLE_SAILS(9);
private byte value;
@@ -25,7 +25,7 @@ public enum TutorialState {
/**
* State for vmg in tutorial
*/
VMG(BoatActionEnum.AUTO_PILOT),
VMG(BoatActionEnum.VMG),
/**
* State for sails-in in tutorial
@@ -12,7 +12,7 @@ public class SailsToggleKey extends ControlKey {
* Constructor for Control
*/
public SailsToggleKey() {
super("Toggle Sails", BoatActionEnum.NOT_A_STATUS);
super("Toggle Sails", BoatActionEnum.TOGGLE_SAILS);
}
/**
@@ -11,7 +11,7 @@ public class VMGKey extends ControlKey{
* Constructor for Control
*/
public VMGKey() {
super("VMG", BoatActionEnum.AUTO_PILOT);
super("VMG", BoatActionEnum.VMG);
}
@Override
@@ -1,12 +1,14 @@
package visualiser.gameController.Keys;
import network.Messages.Enums.BoatActionEnum;
/**
* key to zoom into the game
*/
public class ZoomInKey extends ControlKey {
public ZoomInKey() {
super("Zoom In");
super("Zoom In", BoatActionEnum.ZOOM_IN);
}
@Override
@@ -1,5 +1,7 @@
package visualiser.gameController.Keys;
import network.Messages.Enums.BoatActionEnum;
/**
* Key to zoom out of the game.
*/
@@ -9,7 +11,7 @@ public class ZoomOutKey extends ControlKey{
* Constructor for Control
*/
public ZoomOutKey() {
super("Zoom Out");
super("Zoom Out", BoatActionEnum.ZOOM_OUT);
}
@Override