diff options
Diffstat (limited to 'src/esieequest/ui/rich')
-rw-r--r-- | src/esieequest/ui/rich/RichInterface.java | 85 | ||||
-rw-r--r-- | src/esieequest/ui/rich/UserInterface.java | 707 | ||||
-rw-r--r-- | src/esieequest/ui/rich/app/AppInterface.java | 244 | ||||
-rw-r--r-- | src/esieequest/ui/rich/app/Applet.java (renamed from src/esieequest/ui/rich/Applet.java) | 7 | ||||
-rw-r--r-- | src/esieequest/ui/rich/app/Layout.java | 371 | ||||
-rw-r--r-- | src/esieequest/ui/rich/app/Window.java (renamed from src/esieequest/ui/rich/Window.java) | 6 | ||||
-rw-r--r-- | src/esieequest/ui/rich/app/package-info.java | 5 | ||||
-rw-r--r-- | src/esieequest/ui/rich/package-info.java | 7 | ||||
-rw-r--r-- | src/esieequest/ui/rich/web/Layout.java | 238 | ||||
-rw-r--r-- | src/esieequest/ui/rich/web/Layout.ui.xml | 89 | ||||
-rw-r--r-- | src/esieequest/ui/rich/web/Main.java | 26 | ||||
-rw-r--r-- | src/esieequest/ui/rich/web/WebInterface.java | 164 | ||||
-rw-r--r-- | src/esieequest/ui/rich/web/package-info.java | 5 |
13 files changed, 1238 insertions, 716 deletions
diff --git a/src/esieequest/ui/rich/RichInterface.java b/src/esieequest/ui/rich/RichInterface.java new file mode 100644 index 0000000..89e66c2 --- /dev/null +++ b/src/esieequest/ui/rich/RichInterface.java | |||
@@ -0,0 +1,85 @@ | |||
1 | package esieequest.ui.rich; | ||
2 | |||
3 | import lombok.Getter; | ||
4 | import esieequest.engine.audioplayer.AudioPlayer; | ||
5 | import esieequest.engine.datastore.DataStore; | ||
6 | import esieequest.engine.scheduler.Callback; | ||
7 | import esieequest.engine.scheduler.Scheduler; | ||
8 | import esieequest.game.states.Scene; | ||
9 | import esieequest.ui.View; | ||
10 | |||
11 | /** | ||
12 | * A rich user interface which can play Scene-s. | ||
13 | * | ||
14 | * @author Pacien TRAN-GIRARD | ||
15 | */ | ||
16 | public abstract class RichInterface extends View { | ||
17 | |||
18 | private final Scheduler scheduler; | ||
19 | |||
20 | @Getter | ||
21 | private final AudioPlayer audioPlayer; | ||
22 | |||
23 | /** | ||
24 | * Instantiates a new rich user interface. | ||
25 | * | ||
26 | * @param dataStore | ||
27 | * the data store | ||
28 | * @param scheduler | ||
29 | * the scheduler | ||
30 | * @param audioPlayer | ||
31 | * the audio player | ||
32 | */ | ||
33 | public RichInterface(final DataStore dataStore, final Scheduler scheduler, | ||
34 | final AudioPlayer audioPlayer) { | ||
35 | super(dataStore); | ||
36 | |||
37 | this.scheduler = scheduler; | ||
38 | this.audioPlayer = audioPlayer; | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * Sets the label. | ||
43 | * | ||
44 | * @param label | ||
45 | * the value of the label | ||
46 | */ | ||
47 | public abstract void setLabel(final String label); | ||
48 | |||
49 | /** | ||
50 | * Sets the illustration frame. | ||
51 | * | ||
52 | * @param frameName | ||
53 | * the path to the frame to display | ||
54 | */ | ||
55 | public abstract void setFrame(final String frameName); | ||
56 | |||
57 | @Override | ||
58 | public void playScene(final Scene scene, final Callback callback) { | ||
59 | this.disableInput(); | ||
60 | |||
61 | this.setLabel(scene.getTitle()); | ||
62 | this.echo(scene.getText()); | ||
63 | this.setFrame(scene.name()); | ||
64 | this.audioPlayer.play(scene.name()); | ||
65 | |||
66 | this.scheduler.schedule(callback, scene.getDuration()); | ||
67 | } | ||
68 | |||
69 | @Override | ||
70 | public void skipScene() { | ||
71 | this.scheduler.cancel(); | ||
72 | this.scheduler.run(); | ||
73 | } | ||
74 | |||
75 | @Override | ||
76 | public void stopMusic() { | ||
77 | this.audioPlayer.stop(); | ||
78 | } | ||
79 | |||
80 | @Override | ||
81 | public void toggleMute() { | ||
82 | this.audioPlayer.toggleMute(); | ||
83 | } | ||
84 | |||
85 | } | ||
diff --git a/src/esieequest/ui/rich/UserInterface.java b/src/esieequest/ui/rich/UserInterface.java deleted file mode 100644 index 636905d..0000000 --- a/src/esieequest/ui/rich/UserInterface.java +++ /dev/null | |||
@@ -1,707 +0,0 @@ | |||
1 | package esieequest.ui.rich; | ||
2 | |||
3 | import java.awt.BorderLayout; | ||
4 | import java.awt.Dimension; | ||
5 | import java.awt.Font; | ||
6 | import java.awt.Graphics; | ||
7 | import java.awt.GridLayout; | ||
8 | import java.awt.Image; | ||
9 | import java.awt.event.ActionEvent; | ||
10 | import java.awt.event.ActionListener; | ||
11 | import java.awt.event.FocusEvent; | ||
12 | import java.awt.event.FocusListener; | ||
13 | import java.awt.event.KeyEvent; | ||
14 | import java.awt.image.BufferedImage; | ||
15 | import java.io.FileWriter; | ||
16 | import java.io.IOException; | ||
17 | import java.net.URL; | ||
18 | import java.nio.file.Files; | ||
19 | import java.nio.file.Path; | ||
20 | import java.nio.file.Paths; | ||
21 | import java.util.HashMap; | ||
22 | import java.util.Map.Entry; | ||
23 | import java.util.Timer; | ||
24 | import java.util.TimerTask; | ||
25 | |||
26 | import javax.swing.AbstractAction; | ||
27 | import javax.swing.JButton; | ||
28 | import javax.swing.JComponent; | ||
29 | import javax.swing.JFileChooser; | ||
30 | import javax.swing.JLabel; | ||
31 | import javax.swing.JPanel; | ||
32 | import javax.swing.JTextField; | ||
33 | import javax.swing.JTextPane; | ||
34 | import javax.swing.KeyStroke; | ||
35 | import javax.swing.border.EmptyBorder; | ||
36 | import javax.swing.filechooser.FileNameExtensionFilter; | ||
37 | |||
38 | import lombok.Getter; | ||
39 | |||
40 | import org.newdawn.easyogg.OggClip; | ||
41 | |||
42 | import com.wordpress.tipsforjava.swing.StretchIcon; | ||
43 | |||
44 | import esieequest.engine.GameEngine; | ||
45 | import esieequest.engine.commands.Command; | ||
46 | import esieequest.game.Text; | ||
47 | import esieequest.game.items.Inventory; | ||
48 | import esieequest.game.items.Item; | ||
49 | import esieequest.game.map.Direction; | ||
50 | import esieequest.game.map.Orientation; | ||
51 | import esieequest.game.map.Room; | ||
52 | import esieequest.game.map.Side; | ||
53 | import esieequest.game.states.Callback; | ||
54 | import esieequest.game.states.Quest; | ||
55 | import esieequest.game.states.Scene; | ||
56 | import esieequest.ui.Viewable; | ||
57 | |||
58 | /** | ||
59 | * The Swing based graphical user interface. | ||
60 | * | ||
61 | * @author Pacien TRAN-GIRARD | ||
62 | * @author BenoƮt LUBRANO DI SBARAGLIONE | ||
63 | */ | ||
64 | abstract class UserInterface implements Viewable, ActionListener { | ||
65 | |||
66 | private static final String ILLUSTRATION_DIR = "resources/images/"; | ||
67 | private static final String ILLUSTRATION_EXT = ".jpg"; | ||
68 | |||
69 | private static final String SOUND_DIR = "resources/audio/"; | ||
70 | private static final String SOUND_EXT = ".ogg"; | ||
71 | |||
72 | private static final String SAVE_LABEL = "ESIEEquest Game"; | ||
73 | private static final String SAVE_EXT = "eqg"; | ||
74 | |||
75 | private GameEngine gameEngine; | ||
76 | |||
77 | @Getter | ||
78 | private JPanel layout; | ||
79 | |||
80 | private JTextPane questTextPane; | ||
81 | |||
82 | private JLabel imageLabel; | ||
83 | |||
84 | private JPanel menuPanel; | ||
85 | private JPanel questPanel; | ||
86 | private JPanel gamePanel; | ||
87 | |||
88 | private JButton newButton; | ||
89 | private JButton soundButton; | ||
90 | private JPanel filePanel; | ||
91 | private JButton loadButton; | ||
92 | private JButton saveButton; | ||
93 | |||
94 | private JPanel imagePanel; | ||
95 | |||
96 | private JPanel userPanel; | ||
97 | private JPanel dispPanel; | ||
98 | |||
99 | private JPanel consolePanel; | ||
100 | private JPanel inventoryPanel; | ||
101 | |||
102 | private JPanel controlPanel; | ||
103 | private JPanel topControlPanel; | ||
104 | private JPanel bottomControlPanel; | ||
105 | |||
106 | private JTextPane infoTextPane; | ||
107 | private JTextField inputField; | ||
108 | |||
109 | private JButton forwardButton; | ||
110 | private JButton inventoryButton; | ||
111 | private JButton actionButton; | ||
112 | private JButton backButton; | ||
113 | private JButton leftButton; | ||
114 | private JButton rightButton; | ||
115 | |||
116 | private Timer timer; | ||
117 | private TimerTask timerTask; | ||
118 | private boolean scenePlaying; | ||
119 | |||
120 | private OggClip audio; | ||
121 | private boolean muted; | ||