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.java17
-rw-r--r--src/esieequest/controller/Interpreter.java6
-rw-r--r--src/esieequest/controller/Parser.java19
-rw-r--r--src/esieequest/controller/Performer.java25
-rw-r--r--src/esieequest/controller/package-info.java8
-rw-r--r--src/esieequest/esieequest.gwt.xml35
-rw-r--r--src/esieequest/model/Game.java9
-rw-r--r--src/esieequest/model/command/package-info.java8
-rw-r--r--src/esieequest/model/package-info.java8
-rw-r--r--src/esieequest/package-info.java11
-rw-r--r--src/esieequest/view/Console.java61
-rw-r--r--src/esieequest/view/View.java16
-rw-r--r--src/esieequest/view/app/Applet.java (renamed from src/esieequest/view/Applet.java)10
-rw-r--r--src/esieequest/view/app/UserInterface.java (renamed from src/esieequest/view/UserInterface.java)56
-rw-r--r--src/esieequest/view/app/Window.java (renamed from src/esieequest/view/Window.java)8
-rw-r--r--src/esieequest/view/console/Console.java59
-rw-r--r--src/esieequest/view/package-info.java8
-rw-r--r--src/esieequest/view/web/Main.java18
-rw-r--r--src/esieequest/view/web/WebInterface.java123
-rw-r--r--src/esieequest/view/web/WebInterface.ui.xml97
-rw-r--r--src/net/homelinux/nikiroo/utils/gui/JBackgroundPanel.java308
22 files changed, 427 insertions, 505 deletions
diff --git a/src/esieequest/Main.java b/src/esieequest/Main.java
index add0fb1..5a08f1d 100755
--- a/src/esieequest/Main.java
+++ b/src/esieequest/Main.java
@@ -1,13 +1,15 @@
1package esieequest; 1package esieequest;
2 2
3import java.util.Arrays;
4
3import javax.swing.JApplet; 5import javax.swing.JApplet;
4 6
5import esieequest.controller.GameEngine; 7import esieequest.controller.GameEngine;
6import esieequest.model.Game; 8import esieequest.model.Game;
7import esieequest.view.Applet;
8import esieequest.view.Console;
9import esieequest.view.View; 9import esieequest.view.View;
10import esieequest.view.Window; 10import esieequest.view.app.Applet;
11import esieequest.view.app.Window;
12import esieequest.view.console.Console;
11 13
12/** 14/**
13 * This class instantiates the game and makes it possible to run it via the 15 * This class instantiates the game and makes it possible to run it via the
@@ -28,9 +30,8 @@ public class Main extends JApplet {
28 public void init() { 30 public void init() {
29 // applet 31 // applet
30 Game vGame = new Game(); 32 Game vGame = new Game();
31 Applet vApplet = new Applet(vGame, this); 33 Applet vApplet = new Applet(this);
32 vGame.addObserver(vApplet); 34 new GameEngine(vGame, vApplet);
33 GameEngine vGameEngine = new GameEngine(vGame, vApplet);
34 } 35 }
35 36
36 public static void main(final String[] pArgs) { 37 public static void main(final String[] pArgs) {
@@ -38,15 +39,14 @@ public class Main extends JApplet {
38 Game vGame = new Game(); 39 Game vGame = new Game();
39 View vView; 40 View vView;
40 41
41 if (pArgs.length != 0) { 42 if (Arrays.asList(pArgs).contains("--nogui")) {
42 vView = new Console(vGame); 43 vView = new Console();
43 44
44 } else { 45 } else {
45 vView = new Window(vGame); 46 vView = new Window();
46 } 47 }
47 48
48 vGame.addObserver(vView); 49 new GameEngine(vGame, vView);
49 GameEngine vGameEngine = new GameEngine(vGame, vView);
50 } 50 }
51 51
52} 52}
diff --git a/src/esieequest/controller/GameEngine.java b/src/esieequest/controller/GameEngine.java
index 72de63a..3999cd0 100644
--- a/src/esieequest/controller/GameEngine.java
+++ b/src/esieequest/controller/GameEngine.java
@@ -1,8 +1,5 @@
1package esieequest.controller; 1package esieequest.controller;
2 2
3import java.awt.event.ActionEvent;
4import java.awt.event.ActionListener;
5
6import esieequest.model.Game; 3import esieequest.model.Game;
7import esieequest.view.View; 4import esieequest.view.View;
8 5
@@ -15,7 +12,7 @@ import esieequest.view.View;
15 * 12 *
16 * @version February 2014 13 * @version February 2014
17 */ 14 */
18public class GameEngine implements ActionListener { 15public class GameEngine {
19 16
20 private Game aGame; 17 private Game aGame;
21 private View aView; 18 private View aView;
@@ -26,9 +23,10 @@ public class GameEngine implements ActionListener {
26 this.aGame = pGame; 23 this.aGame = pGame;
27 this.aView = pView; 24 this.aView = pView;
28 25
29 this.aInterpreter = new Interpreter(this.aGame, this.aView); 26 this.aView.setModel(pGame);
27 this.aView.setController(this);
30 28
31 this.aView.setActionListener(this); 29 this.aInterpreter = new Interpreter(this.aGame, this.aView);
32 30
33 this.startGame(); 31 this.startGame();
34 this.startView(); 32 this.startView();
@@ -40,12 +38,11 @@ public class GameEngine implements ActionListener {
40 } 38 }
41 39
42 private void startView() { 40 private void startView() {
43 this.aView.start(); 41 this.aView.enable();
44 } 42 }
45 43
46 @Override 44 public void interpret(final String pCommandString) {
47 public void actionPerformed(final ActionEvent pActionEvent) { 45 this.aInterpreter.interpret(pCommandString);
48 this.aInterpreter.interpret(pActionEvent.getActionCommand());
49 } 46 }
50 47
51} 48}
diff --git a/src/esieequest/controller/Interpreter.java b/src/esieequest/controller/Interpreter.java
index 1e2937b..b4fbb3e 100644
--- a/src/esieequest/controller/Interpreter.java
+++ b/src/esieequest/controller/Interpreter.java
@@ -3,10 +3,6 @@
3 */ 3 */
4package esieequest.controller; 4package esieequest.controller;
5 5
6import java.awt.event.ActionEvent;
7import java.awt.event.ActionListener;
8import java.util.StringTokenizer;
9
10import esieequest.model.Game; 6import esieequest.model.Game;
11import esieequest.model.command.Command; 7import esieequest.model.command.Command;
12import esieequest.view.View; 8import esieequest.view.View;
@@ -62,7 +58,7 @@ public class Interpreter {
62 return; 58 return;
63 } 59 }
64 } 60 }
65 this.aPerformer.showMessage("Unknown command."); 61 this.aPerformer.echo("Unknown command.");
66 return; 62 return;
67 } 63 }
68} 64}
diff --git a/src/esieequest/controller/Parser.java b/src/esieequest/controller/Parser.java
index bd36041..c9095fe 100644
--- a/src/esieequest/controller/Parser.java
+++ b/src/esieequest/controller/Parser.java
@@ -1,7 +1,5 @@
1package esieequest.controller; 1package esieequest.controller;
2 2
3import java.util.StringTokenizer;
4
5import esieequest.model.command.Command; 3import esieequest.model.command.Command;
6 4
7public class Parser { 5public class Parser {
@@ -10,22 +8,23 @@ public class Parser {
10 } 8 }
11 9
12 public Command getCommand(final String pCommandString) { 10 public Command getCommand(final String pCommandString) {
13 StringTokenizer vTokenizer = new StringTokenizer(pCommandString); 11 String[] vElements = pCommandString.split(" ");
14 12
15 String vAction = null; 13 String vAction = null;
16 String vOption = null; 14 String vOption = null;
17 15
18 if (vTokenizer.hasMoreTokens()) { 16 if (vElements.length > 0) {
19 vAction = vTokenizer.nextToken(); 17 vAction = vElements[0];
20 if (vTokenizer.hasMoreTokens()) { 18 }
21 vOption = vTokenizer.nextToken(); 19 if (vElements.length > 1) {
22 } 20 vOption = vElements[1];
23 } 21 }
22
24 return new Command(vAction, vOption); 23 return new Command(vAction, vOption);
25 } 24 }
26 25
27 private void validateCommand() { 26 private void validateCommand() {
28 27 // TODO
29 } 28 }
30 29
31} 30}
diff --git a/src/esieequest/controller/Performer.java b/src/esieequest/controller/Performer.java
index db52c4f..c56ef39 100644
--- a/src/esieequest/controller/Performer.java
+++ b/src/esieequest/controller/Performer.java
@@ -21,53 +21,52 @@ public class Performer {
21 this.aView = pView;