aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-04-06 23:24:11 +0200
committerPacien TRAN-GIRARD2014-04-06 23:24:11 +0200
commit159b168b2618e4bf73130cba262570e70a374438 (patch)
treef33090dea16167c4fdfc7af6bff1e6fbfcffc6c5
parent9b83decf530f2bc8aafd215b18e03c48e07f4fa2 (diff)
downloadesieequest-159b168b2618e4bf73130cba262570e70a374438.tar.gz
Reimplement help command
-rw-r--r--src/esieequest/controller/Parser.java2
-rw-r--r--src/esieequest/controller/Performer.java12
-rw-r--r--src/esieequest/view/web/WebInterface.java8
3 files changed, 14 insertions, 8 deletions
diff --git a/src/esieequest/controller/Parser.java b/src/esieequest/controller/Parser.java
index cea2b78..7b07efb 100644
--- a/src/esieequest/controller/Parser.java
+++ b/src/esieequest/controller/Parser.java
@@ -32,7 +32,7 @@ class Parser {
32 32
33 try { 33 try {
34 action = CommandWord.valueOf(elements[0].toUpperCase()); 34 action = CommandWord.valueOf(elements[0].toUpperCase());
35 } catch (Exception e) { 35 } catch (final Exception e) {
36 action = CommandWord.UNKNOWN; 36 action = CommandWord.UNKNOWN;
37 } finally { 37 } finally {
38 if (elements.length > 1) { 38 if (elements.length > 1) {
diff --git a/src/esieequest/controller/Performer.java b/src/esieequest/controller/Performer.java
index 8f8afeb..7ba8c94 100644
--- a/src/esieequest/controller/Performer.java
+++ b/src/esieequest/controller/Performer.java
@@ -1,6 +1,10 @@
1package esieequest.controller; 1package esieequest.controller;
2 2
3import java.util.HashSet;
4import java.util.Set;
5
3import esieequest.model.Game; 6import esieequest.model.Game;
7import esieequest.model.commands.CommandWord;
4import esieequest.model.items.Inventory; 8import esieequest.model.items.Inventory;
5import esieequest.model.map.Room; 9import esieequest.model.map.Room;
6import esieequest.view.View; 10import esieequest.view.View;
@@ -88,9 +92,11 @@ class Performer {
88 * Displays the help message and the available commands. 92 * Displays the help message and the available commands.
89 */ 93 */
90 public void showHelp() { 94 public void showHelp() {
91 this.notImplemented(); 95 final Set<String> commands = new HashSet<String>();
92 // this.echo(this.game.getHelpMessage()); 96 for (final CommandWord command : CommandWord.values()) {
93 // TODO: list commands 97 commands.add(command.name().toLowerCase());
98 }
99 this.echo(Utils.list(commands, "Commands:", "No commands."));
94 } 100 }
95 101
96 /** 102 /**
diff --git a/src/esieequest/view/web/WebInterface.java b/src/esieequest/view/web/WebInterface.java
index 409414b..452284d 100644
--- a/src/esieequest/view/web/WebInterface.java
+++ b/src/esieequest/view/web/WebInterface.java
@@ -154,10 +154,10 @@ class WebInterface extends Composite implements View {
154 this.loadButton.addClickHandler(this.makeClickHandler(CommandWord.LOAD.name())); 154 this.loadButton.addClickHandler(this.makeClickHandler(CommandWord.LOAD.name()));
155 this.saveButton.addClickHandler(this.makeClickHandler(CommandWord.SAVE.name())); 155 this.saveButton.addClickHandler(this.makeClickHandler(CommandWord.SAVE.name()));
156 this.actionButton.addClickHandler(this.makeClickHandler(CommandWord.DO.name())); 156 this.actionButton.addClickHandler(this.makeClickHandler(CommandWord.DO.name()));
157 this.forwardButton.addClickHandler(this.makeClickHandler(CommandWord.GO.name()+" forward")); 157 this.forwardButton.addClickHandler(this.makeClickHandler(CommandWord.GO.name() + " forward"));
158 this.backButton.addClickHandler(this.makeClickHandler(CommandWord.GO.name()+" back")); 158 this.backButton.addClickHandler(this.makeClickHandler(CommandWord.GO.name() + " back"));
159 this.leftButton.addClickHandler(this.makeClickHandler(CommandWord.TURN.name()+" left")); 159 this.leftButton.addClickHandler(this.makeClickHandler(CommandWord.TURN.name() + " left"));
160 this.rightButton.addClickHandler(this.makeClickHandler(CommandWord.TURN.name()+" right")); 160 this.rightButton.addClickHandler(this.makeClickHandler(CommandWord.TURN.name() + " right"));
161 161
162 this.soundButton.addClickHandler(new ClickHandler() { 162 this.soundButton.addClickHandler(new ClickHandler() {
163 @Override 163 @Override