aboutsummaryrefslogtreecommitdiff
path: root/src/esieequest/ui/rich
diff options
context:
space:
mode:
Diffstat (limited to 'src/esieequest/ui/rich')
-rw-r--r--src/esieequest/ui/rich/RichInterface.java85
-rw-r--r--src/esieequest/ui/rich/UserInterface.java707
-rw-r--r--src/esieequest/ui/rich/app/AppInterface.java244
-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.java371
-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.java5
-rw-r--r--src/esieequest/ui/rich/package-info.java7
-rw-r--r--src/esieequest/ui/rich/web/Layout.java238
-rw-r--r--src/esieequest/ui/rich/web/Layout.ui.xml89
-rw-r--r--src/esieequest/ui/rich/web/Main.java26
-rw-r--r--src/esieequest/ui/rich/web/WebInterface.java164
-rw-r--r--src/esieequest/ui/rich/web/package-info.java5
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 @@
1package esieequest.ui.rich;
2
3import lombok.Getter;
4import esieequest.engine.audioplayer.AudioPlayer;
5import esieequest.engine.datastore.DataStore;
6import esieequest.engine.scheduler.Callback;
7import esieequest.engine.scheduler.Scheduler;
8import esieequest.game.states.Scene;
9import esieequest.ui.View;
10
11/**
12 * A rich user interface which can play Scene-s.
13 *
14 * @author Pacien TRAN-GIRARD
15 */
16public 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 @@
1package esieequest.ui.rich;
2
3import java.awt.BorderLayout;
4import java.awt.Dimension;
5import java.awt.Font;
6import java.awt.Graphics;
7import java.awt.GridLayout;
8import java.awt.Image;
9import java.awt.event.ActionEvent;
10import java.awt.event.ActionListener;
11import java.awt.event.FocusEvent;
12import java.awt.event.FocusListener;
13import java.awt.event.KeyEvent;
14import java.awt.image.BufferedImage;
15import java.io.FileWriter;
16import java.io.IOException;
17import java.net.URL;
18import java.nio.file.Files;
19import java.nio.file.Path;
20import java.nio.file.Paths;
21import java.util.HashMap;
22import java.util.Map.Entry;
23import java.util.Timer;
24import java.util.TimerTask;
25
26import javax.swing.AbstractAction;
27import javax.swing.JButton;
28import javax.swing.JComponent;
29import javax.swing.JFileChooser;
30import javax.swing.JLabel;
31import javax.swing.JPanel;
32import javax.swing.JTextField;
33import javax.swing.JTextPane;
34import javax.swing.KeyStroke;
35import javax.swing.border.EmptyBorder;
36import javax.swing.filechooser.FileNameExtensionFilter;
37
38import lombok.Getter;
39
40import org.newdawn.easyogg.OggClip;
41
42import com.wordpress.tipsforjava.swing.StretchIcon;
43
44import esieequest.engine.GameEngine;
45import esieequest.engine.commands.Command;
46import esieequest.game.Text;
47import esieequest.game.items.Inventory;
48import esieequest.game.items.Item;
49import esieequest.game.map.Direction;
50import esieequest.game.map.Orientation;
51import esieequest.game.map.Room;
52import esieequest.game.map.Side;
53import esieequest.game.states.Callback;
54import esieequest.game.states.Quest;
55import esieequest.game.states.Scene;
56import 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 */
64abstract 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;