diff options
author | Pacien TRAN-GIRARD | 2014-05-18 14:44:41 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2014-05-18 14:44:41 +0200 |
commit | e37dc7b99ffa2c518bb1ab8a5d46074587d1c911 (patch) | |
tree | 05006a9402f6637403a318c9b01817c32ee78d2e | |
parent | 7f70290e780f9a9ae0c98d198c8695449a20026c (diff) | |
download | esieequest-e37dc7b99ffa2c518bb1ab8a5d46074587d1c911.tar.gz |
Refactor graphical and web interfaces
27 files changed, 308 insertions, 226 deletions
diff --git a/src/esieequest/controller/GameEngine.java b/src/esieequest/controller/GameEngine.java index df83384..8e53888 100644 --- a/src/esieequest/controller/GameEngine.java +++ b/src/esieequest/controller/GameEngine.java | |||
@@ -67,7 +67,7 @@ public class GameEngine { | |||
67 | 67 | ||
68 | final Command command = input.getCommand(); | 68 | final Command command = input.getCommand(); |
69 | if (command == null) { | 69 | if (command == null) { |
70 | this.view.echo(Text.UNKNOWN_COMMAND.getText()); | 70 | this.view.echo(Text.UNKNOWN_COMMAND.toString()); |
71 | return; | 71 | return; |
72 | } | 72 | } |
73 | 73 | ||
diff --git a/src/esieequest/controller/commands/AleaCommand.java b/src/esieequest/controller/commands/AleaCommand.java index 33f4deb..ff73537 100644 --- a/src/esieequest/controller/commands/AleaCommand.java +++ b/src/esieequest/controller/commands/AleaCommand.java | |||
@@ -24,12 +24,12 @@ public class AleaCommand implements Executable { | |||
24 | try { | 24 | try { |
25 | destinationRoom = Room.valueOf(forcedRoomName.toUpperCase()); | 25 | destinationRoom = Room.valueOf(forcedRoomName.toUpperCase()); |
26 | } catch (final Exception exception) { | 26 | } catch (final Exception exception) { |
27 | view.echo(Text.NO_SUCH_ROOM.getText()); | 27 | view.echo(Text.NO_SUCH_ROOM.toString()); |
28 | return; | 28 | return; |
29 | } | 29 | } |
30 | view.echo(Text.ALEA_OVERRIDE_ENABLED.getText()); | 30 | view.echo(Text.ALEA_OVERRIDE_ENABLED.toString()); |
31 | } else { | 31 | } else { |
32 | view.echo(Text.ALEA_OVERRIDE_DISABLED.getText()); | 32 | view.echo(Text.ALEA_OVERRIDE_DISABLED.toString()); |
33 | } | 33 | } |
34 | 34 | ||
35 | TransporterDoor.forceDestination(destinationRoom); | 35 | TransporterDoor.forceDestination(destinationRoom); |
diff --git a/src/esieequest/controller/commands/Command.java b/src/esieequest/controller/commands/Command.java index 094b0cf..ca8909c 100644 --- a/src/esieequest/controller/commands/Command.java +++ b/src/esieequest/controller/commands/Command.java | |||
@@ -94,7 +94,7 @@ public enum Command { | |||
94 | * @return a String listing all the names of the Command-s | 94 | * @return a String listing all the names of the Command-s |
95 | */ | 95 | */ |
96 | public static String listCommandsNamesString() { | 96 | public static String listCommandsNamesString() { |
97 | return ListUtils.listToString(Command.listCommandsNames(), Text.HELP_PREFIX.getText(), null, Text.HELP_SUFFIX.getText()); | 97 | return ListUtils.listToString(Command.listCommandsNames(), Text.HELP_PREFIX.toString(), null, Text.HELP_SUFFIX.toString()); |
98 | } | 98 | } |
99 | 99 | ||
100 | } | 100 | } |
diff --git a/src/esieequest/controller/commands/DoCommand.java b/src/esieequest/controller/commands/DoCommand.java index 95269de..646ac2a 100644 --- a/src/esieequest/controller/commands/DoCommand.java +++ b/src/esieequest/controller/commands/DoCommand.java | |||
@@ -28,7 +28,7 @@ public class DoCommand implements Executable { | |||
28 | return; | 28 | return; |
29 | } | 29 | } |
30 | 30 | ||
31 | view.echo(Text.NOTHING_TO_DO.getText()); | 31 | view.echo(Text.NOTHING_TO_DO.toString()); |
32 | 32 | ||
33 | } | 33 | } |
34 | 34 | ||
diff --git a/src/esieequest/controller/commands/DropCommand.java b/src/esieequest/controller/commands/DropCommand.java index b253d98..4e6f877 100644 --- a/src/esieequest/controller/commands/DropCommand.java +++ b/src/esieequest/controller/commands/DropCommand.java | |||
@@ -19,12 +19,12 @@ public class DropCommand implements Executable { | |||
19 | final String itemName = argument; | 19 | final String itemName = argument; |
20 | 20 | ||
21 | if (itemName == null) { | 21 | if (itemName == null) { |
22 | view.echo(Text.NO_ITEM_SPECIFIED.getText()); | 22 | view.echo(Text.NO_ITEM_SPECIFIED.toString()); |
23 | return; | 23 | return; |
24 | } | 24 | } |
25 | 25 | ||
26 | if (!game.getPlayer().getInventory().hasItem(itemName)) { | 26 | if (!game.getPlayer().getInventory().hasItem(itemName)) { |
27 | view.echo(Text.NO_SUCH_ITEM.getText()); | 27 | view.echo(Text.NO_SUCH_ITEM.toString()); |
28 | return; | 28 | return; |
29 | } | 29 | } |
30 | 30 | ||
diff --git a/src/esieequest/controller/commands/GoCommand.java b/src/esieequest/controller/commands/GoCommand.java index 1c528fa..f536f64 100644 --- a/src/esieequest/controller/commands/GoCommand.java +++ b/src/esieequest/controller/commands/GoCommand.java | |||
@@ -22,14 +22,14 @@ public class GoCommand implements Executable { | |||
22 | try { | 22 | try { |
23 | direction = Direction.valueOf(argument.toUpperCase()); | 23 | direction = Direction.valueOf(argument.toUpperCase()); |
24 | } catch (final Exception exception) { | 24 | } catch (final Exception exception) { |
25 | view.echo(Text.NO_SUCH_DIRECTION.getText()); | 25 | view.echo(Text.NO_SUCH_DIRECTION.toString()); |
26 | return; | 26 | return; |
27 | } | 27 | } |
28 | 28 | ||
29 | final Door door = game.getPlayer().getCurrentRoom().getSide(direction).getDoor(); | 29 | final Door door = game.getPlayer().getCurrentRoom().getSide(direction).getDoor(); |
30 | 30 | ||
31 | if (door == null) { | 31 | if (door == null) { |
32 | view.echo(Text.NO_DOOR.getText()); | 32 | view.echo(Text.NO_DOOR.toString()); |
33 | return; | 33 | return; |
34 | } | 34 | } |
35 | 35 | ||
@@ -43,7 +43,7 @@ public class GoCommand implements Executable { | |||
43 | 43 | ||
44 | // handle challenge mode | 44 | // handle challenge mode |
45 | if (game.getPlayer().walk()) { | 45 | if (game.getPlayer().walk()) { |
46 | view.echo(Text.CHALLENGE_FAILED.getText()); | 46 | view.echo(Text.CHALLENGE_FAILED.toString()); |
47 | view.disable(); | 47 | view.disable(); |
48 | } | 48 | } |
49 | 49 | ||
diff --git a/src/esieequest/controller/commands/LoadCommand.java b/src/esieequest/controller/commands/LoadCommand.java index 807b3b3..8d6fd29 100644 --- a/src/esieequest/controller/commands/LoadCommand.java +++ b/src/esieequest/controller/commands/LoadCommand.java | |||
@@ -24,7 +24,7 @@ public class LoadCommand implements Executable { | |||
24 | try { | 24 | try { |
25 | datas = (JSONObject) JSONValue.parseWithException(jsonString); | 25 | datas = (JSONObject) JSONValue.parseWithException(jsonString); |
26 | } catch (final ParseException e) { | 26 | } catch (final ParseException e) { |
27 | view.echo(Text.PARSING_ERROR_PREFIX.getText() + e.getMessage() + Text.PARSING_ERROR_SUFFIX.getText()); | 27 | view.echo(Text.PARSING_ERROR_PREFIX.toString() + e.getMessage() + Text.PARSING_ERROR_SUFFIX.toString()); |
28 | return; | 28 | return; |
29 | } | 29 | } |
30 | 30 | ||
@@ -32,7 +32,7 @@ public class LoadCommand implements Executable { | |||
32 | game.newGame(false, false); | 32 | game.newGame(false, false); |
33 | game.deserialise(datas); | 33 | game.deserialise(datas); |
34 | } catch (final Exception e) { | 34 | } catch (final Exception e) { |
35 | view.echo(Text.DESERIALISING_ERROR_PREFIX.getText() + e.getMessage() + Text.DESERIALISING_ERROR_SUFFIX.getText()); | 35 | view.echo(Text.DESERIALISING_ERROR_PREFIX.toString() + e.getMessage() + Text.DESERIALISING_ERROR_SUFFIX.toString()); |
36 | e.printStackTrace(); | 36 | e.printStackTrace(); |
37 | return; | 37 | return; |
38 | } | 38 | } |
diff --git a/src/esieequest/controller/commands/LookCommand.java b/src/esieequest/controller/commands/LookCommand.java index 5006a66..ece4ddc 100644 --- a/src/esieequest/controller/commands/LookCommand.java +++ b/src/esieequest/controller/commands/LookCommand.java | |||
@@ -23,7 +23,7 @@ public class LookCommand implements Executable { | |||
23 | informations.add(game.getPlayer().getCurrentRoom().getInformations()); | 23 | informations.add(game.getPlayer().getCurrentRoom().getInformations()); |
24 | informations.add(Text.DIRECTION_PREFIX + game.getPlayer().getCurrentDirection().name().toLowerCase() + Text.DIRECTION_SUFFIX); | 24 | informations.add(Text.DIRECTION_PREFIX + game.getPlayer().getCurrentDirection().name().toLowerCase() + Text.DIRECTION_SUFFIX); |
25 | 25 | ||
26 | view.echo(Joiner.on(Text.NEW_LINE.getText()).join(informations)); | 26 | view.echo(Joiner.on(Text.NEW_LINE.toString()).join(informations)); |
27 | 27 | ||
28 | } | 28 | } |
29 | } | 29 | } |
diff --git a/src/esieequest/controller/commands/NewCommand.java b/src/esieequest/controller/commands/NewCommand.java index 7b510e4..4ce45d0 100644 --- a/src/esieequest/controller/commands/NewCommand.java +++ b/src/esieequest/controller/commands/NewCommand.java | |||
@@ -25,7 +25,7 @@ public class NewCommand implements Executable { | |||
25 | view.enable(); | 25 | view.enable(); |
26 | 26 | ||
27 | view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer().getCurrentDirection(), game.getPlayer().getCurrentSide()); | 27 | view.updateLocation(game.getPlayer().getCurrentRoom(), |