aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/esieequest/Main.java22
-rw-r--r--src/esieequest/controller/GameEngine.java28
-rw-r--r--src/esieequest/controller/Interpreter.java42
-rw-r--r--src/esieequest/controller/Parser.java18
-rw-r--r--src/esieequest/controller/Performer.java64
-rw-r--r--src/esieequest/model/Game.java66
-rw-r--r--src/esieequest/model/Item.java54
-rw-r--r--src/esieequest/model/Room.java63
-rw-r--r--src/esieequest/model/command/Command.java18
-rw-r--r--src/esieequest/model/command/CommandWord.java16
-rw-r--r--src/esieequest/view/View.java6
-rw-r--r--src/esieequest/view/app/Applet.java8
-rw-r--r--src/esieequest/view/app/UserInterface.java345
-rw-r--r--src/esieequest/view/app/Window.java12
-rw-r--r--src/esieequest/view/console/Console.java28
-rw-r--r--src/esieequest/view/web/Main.java6
-rw-r--r--src/esieequest/view/web/WebInterface.java22
17 files changed, 465 insertions, 353 deletions
diff --git a/src/esieequest/Main.java b/src/esieequest/Main.java
index 5a08f1d..b4bfb59 100755
--- a/src/esieequest/Main.java
+++ b/src/esieequest/Main.java
@@ -25,28 +25,28 @@ public class Main extends JApplet {
25 /** 25 /**
26 * 26 *
27 */ 27 */
28 private static final long serialVersionUID = 1726402114771940798L; 28 private static long serialVersionUID = 1726402114771940798L;
29 29
30 public void init() { 30 public void init() {
31 // applet 31 // applet
32 Game vGame = new Game(); 32 Game game = new Game();
33 Applet vApplet = new Applet(this); 33 Applet applet = new Applet(this);
34 new GameEngine(vGame, vApplet); 34 new GameEngine(game, applet);
35 } 35 }
36 36
37 public static void main(final String[] pArgs) { 37 public static void main(String[] args) {
38 // cli or standalone 38 // cli or standalone
39 Game vGame = new Game(); 39 Game game = new Game();
40 View vView; 40 View view;
41 41
42 if (Arrays.asList(pArgs).contains("--nogui")) { 42 if (Arrays.asList(args).contains("--nogui")) {
43 vView = new Console(); 43 view = new Console();
44 44
45 } else { 45 } else {
46 vView = new Window(); 46 view = new Window();
47 } 47 }
48 48
49 new GameEngine(vGame, vView); 49 new GameEngine(game, view);
50 } 50 }
51 51
52} 52}
diff --git a/src/esieequest/controller/GameEngine.java b/src/esieequest/controller/GameEngine.java
index 3999cd0..4a1f47f 100644
--- a/src/esieequest/controller/GameEngine.java
+++ b/src/esieequest/controller/GameEngine.java
@@ -14,35 +14,35 @@ import esieequest.view.View;
14 */ 14 */
15public class GameEngine { 15public class GameEngine {
16 16
17 private Game aGame; 17 private Game game;
18 private View aView; 18 private View view;
19 19
20 private Interpreter aInterpreter; 20 private Interpreter interpreter;
21 21
22 public GameEngine(final Game pGame, final View pView) { 22 public GameEngine(Game game, View view) {
23 this.aGame = pGame; 23 this.game = game;
24 this.aView = pView; 24 this.view = view;
25 25
26 this.aView.setModel(pGame); 26 this.view.setModel(game);
27 this.aView.setController(this); 27 this.view.setController(this);
28 28
29 this.aInterpreter = new Interpreter(this.aGame, this.aView); 29 this.interpreter = new Interpreter(this.game, this.view);
30 30
31 this.startGame(); 31 this.startGame();
32 this.startView(); 32 this.startView();
33 } 33 }
34 34
35 private void startGame() { 35 private void startGame() {
36 this.aGame.setRunning(true); 36 this.game.setRunning(true);
37 this.aInterpreter.interpret("new"); 37 this.interpreter.interpret("new");
38 } 38 }
39 39
40 private void startView() { 40 private void startView() {
41 this.aView.enable(); 41 this.view.enable();
42 } 42 }
43 43
44 public void interpret(final String pCommandString) { 44 public void interpret(String commandString) {
45 this.aInterpreter.interpret(pCommandString); 45 this.interpreter.interpret(commandString);
46 } 46 }
47 47
48} 48}
diff --git a/src/esieequest/controller/Interpreter.java b/src/esieequest/controller/Interpreter.java
index b4fbb3e..55d468b 100644
--- a/src/esieequest/controller/Interpreter.java
+++ b/src/esieequest/controller/Interpreter.java
@@ -13,52 +13,52 @@ import esieequest.view.View;
13 */ 13 */
14public class Interpreter { 14public class Interpreter {
15 15
16 private Performer aPerformer; 16 private Performer performer;
17 private Parser aParser; 17 private Parser parser;
18 18
19 public Interpreter(final Game pGame, final View pView) { 19 public Interpreter(Game game, View view) {
20 this.aPerformer = new Performer(pGame, pView); 20 this.performer = new Performer(game, view);
21 this.aParser = new Parser(); 21 this.parser = new Parser();
22 } 22 }
23 23
24 public void interpret(String pCommandString) { 24 public void interpret(String commandString) {
25 Command vCommand = this.aParser.getCommand(pCommandString); 25 Command command = this.parser.getCommand(commandString);
26 this.dispatch(vCommand); 26 this.dispatch(command);
27 } 27 }
28 28
29 public void dispatch(final Command pCommand) { 29 public void dispatch(Command command) {
30 if (pCommand.getAction() != null) { 30 if (command.getAction() != null) {
31 switch (pCommand.getAction()) { 31 switch (command.getAction()) {
32 case "new": 32 case "new":
33 this.aPerformer.newGame(); 33 this.performer.newGame();
34 return; 34 return;
35 case "load": 35 case "load":
36 this.aPerformer.loadGame(); 36 this.performer.loadGame();
37 return; 37 return;
38 case "save": 38 case "save":
39 this.aPerformer.saveGame(); 39 this.performer.saveGame();
40 return; 40 return;
41 case "sound": 41 case "sound":
42 this.aPerformer.toggleSound(); 42 this.performer.toggleSound();
43 return; 43 return;
44 case "go": 44 case "go":
45 this.aPerformer.goTo(pCommand.getOption()); 45 this.performer.goTo(command.getOption());
46 return; 46 return;
47 case "look": 47 case "look":
48 this.aPerformer.look(); 48 this.performer.look();
49 return; 49 return;
50 case "eat": 50 case "eat":
51 this.aPerformer.eat(); 51 this.performer.eat();
52 return; 52 return;
53 case "help": 53 case "help":
54 this.aPerformer.showHelp(); 54 this.performer.showHelp();
55 return; 55 return;
56 case "quit": 56 case "quit":
57 this.aPerformer.quitGame(); 57 this.performer.quitGame();
58 return; 58 return;
59 } 59 }
60 } 60 }
61 this.aPerformer.echo("Unknown command."); 61 this.performer.echo("Unknown command.");
62 return; 62 return;
63 } 63 }
64} 64}
diff --git a/src/esieequest/controller/Parser.java b/src/esieequest/controller/Parser.java
index c9095fe..117d69f 100644
--- a/src/esieequest/controller/Parser.java
+++ b/src/esieequest/controller/Parser.java
@@ -7,20 +7,20 @@ public class Parser {
7 public Parser() { 7 public Parser() {