mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2026-04-25 11:50:10 +02:00
Compare commits
270 Commits
Testhandbu
...
5143e21ba6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5143e21ba6 | ||
|
|
26dc24a1f4 | ||
|
|
350c157493 | ||
|
|
51b879a7c8 | ||
|
|
528126aa29 | ||
|
|
73bfafa7f7 | ||
|
|
686a12e465 | ||
|
|
358beacc65 | ||
|
|
69db0aa29b | ||
|
|
20f44ad2d4 | ||
|
|
d73c5e0904 | ||
|
|
f322e9bd8f | ||
|
|
b8e1645eb8 | ||
|
|
73a908cd71 | ||
|
|
a6b7ea4ce8 | ||
|
|
4af08ffffd | ||
|
|
dc66fd7384 | ||
|
|
16ff61264b | ||
|
|
f3ec17b0b1 | ||
|
|
1c31915627 | ||
|
|
79c96677bd | ||
|
|
54118071cb | ||
|
|
2e28b54936 | ||
|
|
f333e2d2c0 | ||
|
|
b89d40b39f | ||
|
|
488ae154cf | ||
|
|
c1e501c271 | ||
|
|
89d5185c91 | ||
|
|
f4bf38bca1 | ||
|
|
b87b3f054b | ||
|
|
f6137b8b68 | ||
|
|
87309235bd | ||
|
|
d37017bfa0 | ||
|
|
5d6440bd50 | ||
|
|
a70295f1ff | ||
|
|
b681b13468 | ||
|
|
2c536f32cf | ||
|
|
991fe5280f | ||
|
|
174fe5cfb3 | ||
|
|
119284f256 | ||
|
|
05680af726 | ||
|
|
fba82f670b | ||
|
|
afa2ebd004 | ||
|
|
f0eeff3493 | ||
|
|
44d64c4e0f | ||
|
|
86ece3b70d | ||
|
|
6cdad71693 | ||
|
|
cf6d5ea22e | ||
|
|
ecf227daa6 | ||
|
|
4b5a156865 | ||
|
|
cfae369fd3 | ||
|
|
b05eabbbf8 | ||
|
|
fd178eee43 | ||
|
|
aef2ef34fb | ||
|
|
fcbffa1189 | ||
|
|
0d8240381e | ||
|
|
77da6679ef | ||
|
|
5845254caa | ||
|
|
5d92d7cfcc | ||
|
|
67f6649242 | ||
|
|
1438ae5e4f | ||
|
|
01c351e64b | ||
|
|
b0c21dfcb8 | ||
|
|
f4cddbc87f | ||
|
|
cfce176c82 | ||
|
|
782b1a10c3 | ||
|
|
2d9cd0e4e1 | ||
|
|
908ba09e2a | ||
|
|
4a84ef4b3c | ||
|
|
f3353327dd | ||
|
|
316433f592 | ||
|
|
1ccdea0c87 | ||
|
|
7d9af0c4c7 | ||
|
|
a1247cdae5 | ||
|
|
5696192cce | ||
|
|
91826b730f | ||
|
|
48b1cf817a | ||
|
|
94ba9f0af2 | ||
|
|
333f27a016 | ||
|
|
b67379a6c3 | ||
|
|
1e6188cf24 | ||
|
|
12e859edd5 | ||
|
|
e000dcfc51 | ||
|
|
e7a06159bb | ||
|
|
c900b6384d | ||
|
|
970a0ae254 | ||
|
|
5e0ac0abc7 | ||
|
|
bcd6711965 | ||
|
|
bb63a4df9f | ||
|
|
b4d7349583 | ||
|
|
fed8a3fd2d | ||
|
|
bc6e7174ec | ||
|
|
075f98883a | ||
|
|
c9df3a6176 | ||
|
|
b2d2a79b00 | ||
|
|
26d8283930 | ||
|
|
4079c0a32c | ||
|
|
6d72a94fe4 | ||
|
|
227a7a027f | ||
|
|
9e595b92ba | ||
|
|
c346058631 | ||
|
|
f2678ea33d | ||
|
|
45a43d6998 | ||
|
|
cb9888af7a | ||
|
|
93b183254f | ||
|
|
e92b305a56 | ||
|
|
5b0628da15 | ||
|
|
8d087a8e84 | ||
|
|
1715926c1c | ||
|
|
c8b69efca2 | ||
|
|
7f6011720c | ||
|
|
bdc5f0269f | ||
|
|
a6054e825e | ||
|
|
156e76fe0a | ||
|
|
89587a4c78 | ||
|
|
29cc73e83b | ||
|
|
e56cdb1dcb | ||
|
|
9107a08011 | ||
|
|
0242587a5f | ||
|
|
3ce27023c2 | ||
|
|
174958c6b1 | ||
|
|
c71e8b1e8e | ||
|
|
ada067a2a0 | ||
|
|
f4c4f6bc93 | ||
|
|
6eeb6fd209 | ||
|
|
efba3c496a | ||
|
|
27a0ab52e6 | ||
|
|
d6ce859fcd | ||
|
|
e5f69c9536 | ||
|
|
d8a2225038 | ||
|
|
7b91a679f5 | ||
|
|
840658b590 | ||
|
|
c5e7ef855e | ||
|
|
170227c97f | ||
|
|
379803278b | ||
|
|
3956d8efa7 | ||
|
|
269aceaf1a | ||
|
|
41127565fc | ||
|
|
0e405d2f90 | ||
|
|
f67810b288 | ||
|
|
4095d9e79d | ||
|
|
547a4c2353 | ||
|
|
9120e4d53c | ||
|
|
1a62b76104 | ||
|
|
cc7f277bef | ||
|
|
274df8dfd1 | ||
|
|
2e256f4ff5 | ||
|
|
d10111d2ab | ||
|
|
0c2b266f5e | ||
|
|
16b4dbae18 | ||
|
|
88409dcc99 | ||
|
|
5cacff39b7 | ||
|
|
093723a9d0 | ||
|
|
f67ce6be44 | ||
|
|
1be29b8b7a | ||
|
|
dfdbcdc9f3 | ||
|
|
bd725e2dc4 | ||
|
|
dd9d9144dd | ||
|
|
1a429e4bb6 | ||
|
|
ad6fb5e926 | ||
|
|
72cb7049ba | ||
|
|
2e42f3afac | ||
|
|
8474c9f5bc | ||
|
|
b7ed03f7e8 | ||
|
|
a44b6b5e4c | ||
|
|
5268f75e17 | ||
|
|
687d1621fc | ||
|
|
a6944aa6e3 | ||
|
|
b8365c76a1 | ||
|
|
19216cc174 | ||
|
|
c6a23b9b8e | ||
|
|
c0f42fb1eb | ||
|
|
160873e2cc | ||
|
|
8df859bbef | ||
|
|
e30d10a85d | ||
|
|
bafc3f1db6 | ||
|
|
03571fcf74 | ||
|
|
e7a6802488 | ||
|
|
a6e6b5e158 | ||
|
|
74c3d925e6 | ||
|
|
f67fa4d7f0 | ||
|
|
225a8c0e08 | ||
|
|
9a6ce27fe1 | ||
|
|
437114704a | ||
|
|
9b4cac4e56 | ||
|
|
e780513b35 | ||
|
|
d582c59a7d | ||
|
|
7d2c85f617 | ||
|
|
4a882bc4ac | ||
|
|
3c4eac1fcd | ||
|
|
75d5a15bdb | ||
|
|
17f121f7d1 | ||
|
|
a66c570b51 | ||
|
|
e1e7f2eaf6 | ||
|
|
46d2dce372 | ||
|
|
c39f1f6d4c | ||
|
|
738b04f2d9 | ||
|
|
ecba1c3135 | ||
|
|
748226f4ed | ||
|
|
f658f53ba9 | ||
|
|
4a8304ee4f | ||
|
|
7fe9604338 | ||
|
|
7f09a6dae8 | ||
|
|
270129bc97 | ||
|
|
62ec6f6bef | ||
|
|
b24c14900c | ||
|
|
44c55ce3a6 | ||
|
|
895bea048c | ||
|
|
885ab5bdc9 | ||
|
|
c6355b2c09 | ||
|
|
ada6bf3f24 | ||
|
|
db471ac679 | ||
|
|
84059c4085 | ||
|
|
09b363f943 | ||
|
|
fd347c7780 | ||
|
|
b38a34efa5 | ||
|
|
10e24cf30e | ||
|
|
3369057afb | ||
|
|
7ada56e215 | ||
|
|
373b9e6d53 | ||
|
|
3de31de9f7 | ||
|
|
7252259ab3 | ||
|
|
f33c673a05 | ||
|
|
65a7958b66 | ||
|
|
91e4df7478 | ||
|
|
399606d9a0 | ||
|
|
559afcaffd | ||
|
|
15f5f91ddb | ||
|
|
067a8063a5 | ||
|
|
35e367ba24 | ||
|
|
fe68d991fc | ||
|
|
88dc633e8e | ||
|
|
0b9cbb0f5f | ||
|
|
c3a33b4402 | ||
|
|
e12f00aad6 | ||
|
|
47bac0185f | ||
|
|
dafe1dab2a | ||
|
|
8ba4ea2819 | ||
|
|
f6f708fd5b | ||
|
|
1203077aed | ||
|
|
ddbf79c928 | ||
|
|
aa47dd579f | ||
|
|
cdce478d77 | ||
|
|
f11f4a59f1 | ||
|
|
d631e8df1e | ||
|
|
af80d40700 | ||
|
|
3a6f8a945a | ||
|
|
bb9727d54a | ||
|
|
7da8b3e545 | ||
|
|
b6968df451 | ||
|
|
aa986fb948 | ||
|
|
6e63de6e99 | ||
|
|
962ecd08fa | ||
|
|
580a26b3ea | ||
|
|
0cda6b5fa0 | ||
|
|
cc8c3795b8 | ||
|
|
3c21165efb | ||
|
|
818fdf4670 | ||
|
|
b7d679b492 | ||
|
|
a42093df23 | ||
|
|
6157db51da | ||
|
|
843052989b | ||
|
|
8e01fa3192 | ||
|
|
e2126a7ea7 | ||
|
|
0b46d14650 | ||
|
|
9e28deedf7 | ||
|
|
9c0172b413 | ||
|
|
2933d022aa | ||
|
|
bdefb7193e | ||
|
|
69b68a6975 |
18
Projekte/.run/MonopolyApp (Mac).run.xml
Normal file
18
Projekte/.run/MonopolyApp (Mac).run.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="MonopolyApp (Mac)" type="Application" factoryName="Application"
|
||||||
|
singleton="false">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="pp.monopoly.client.MonopolyApp"/>
|
||||||
|
<module name="Projekte.monopoly.client.main"/>
|
||||||
|
<option name="VM_PARAMETERS" value="-XstartOnFirstThread"/>
|
||||||
|
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$"/>
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="pp.monopoly.client.*"/>
|
||||||
|
<option name="ENABLED" value="true"/>
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true"/>
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
18
Projekte/.run/MonopolyApp.run.xml
Normal file
18
Projekte/.run/MonopolyApp.run.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="MonopolyApp" type="Application" factoryName="Application" singleton="false"
|
||||||
|
nameIsGenerated="true">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="pp.monopoly.client.MonopolyApp"/>
|
||||||
|
<module name="Projekte.monopoly.client.main"/>
|
||||||
|
<option name="VM_PARAMETERS" value="-Djava.util.logging.config.file=logging.properties"/>
|
||||||
|
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$"/>
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="pp.monopoly.client.*"/>
|
||||||
|
<option name="ENABLED" value="true"/>
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true"/>
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
17
Projekte/.run/MonopolyServer.run.xml
Normal file
17
Projekte/.run/MonopolyServer.run.xml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="MonopolyServer" type="Application" factoryName="Application"
|
||||||
|
nameIsGenerated="true">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="pp.monopoly.server.MonopolyServer"/>
|
||||||
|
<module name="Projekte.monopoly.server.main"/>
|
||||||
|
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$"/>
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="pp.monopoly.server.*"/>
|
||||||
|
<option name="ENABLED" value="true"/>
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true"/>
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@@ -7,22 +7,22 @@
|
|||||||
|
|
||||||
package pp.battleship.client;
|
package pp.battleship.client;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
import com.simsilica.lemur.Button;
|
import com.simsilica.lemur.Button;
|
||||||
import com.simsilica.lemur.Checkbox;
|
import com.simsilica.lemur.Checkbox;
|
||||||
import com.simsilica.lemur.Label;
|
import com.simsilica.lemur.Label;
|
||||||
import com.simsilica.lemur.style.ElementId;
|
import com.simsilica.lemur.style.ElementId;
|
||||||
|
|
||||||
|
import static pp.battleship.Resources.lookup;
|
||||||
import pp.battleship.client.gui.GameMusic;
|
import pp.battleship.client.gui.GameMusic;
|
||||||
import pp.battleship.client.gui.VolumeSlider;
|
|
||||||
import pp.dialog.Dialog;
|
import pp.dialog.Dialog;
|
||||||
import pp.dialog.StateCheckboxModel;
|
import pp.dialog.StateCheckboxModel;
|
||||||
import pp.dialog.TextInputDialog;
|
import pp.dialog.TextInputDialog;
|
||||||
|
import pp.battleship.client.gui.VolumeSlider;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.prefs.Preferences;
|
|
||||||
|
|
||||||
import static pp.battleship.Resources.lookup;
|
|
||||||
import static pp.util.PreferencesUtils.getPreferences;
|
import static pp.util.PreferencesUtils.getPreferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +39,7 @@ class Menu extends Dialog {
|
|||||||
private final VolumeSlider slider;
|
private final VolumeSlider slider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the Menu dialog for the Battleship application.
|
* Constructs the Menu dialog for the Battleship application.+
|
||||||
*
|
*
|
||||||
* @param app the BattleshipApp instance
|
* @param app the BattleshipApp instance
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,24 +7,23 @@
|
|||||||
|
|
||||||
package pp.battleship.client;
|
package pp.battleship.client;
|
||||||
|
|
||||||
|
import java.lang.System.Logger;
|
||||||
|
import java.lang.System.Logger.Level;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import com.simsilica.lemur.Button;
|
import com.simsilica.lemur.Button;
|
||||||
import com.simsilica.lemur.Container;
|
import com.simsilica.lemur.Container;
|
||||||
import com.simsilica.lemur.Label;
|
import com.simsilica.lemur.Label;
|
||||||
import com.simsilica.lemur.TextField;
|
import com.simsilica.lemur.TextField;
|
||||||
import com.simsilica.lemur.component.SpringGridLayout;
|
import com.simsilica.lemur.component.SpringGridLayout;
|
||||||
|
|
||||||
|
import static pp.battleship.Resources.lookup;
|
||||||
import pp.battleship.server.BattleshipServer;
|
import pp.battleship.server.BattleshipServer;
|
||||||
import pp.dialog.Dialog;
|
import pp.dialog.Dialog;
|
||||||
import pp.dialog.DialogBuilder;
|
import pp.dialog.DialogBuilder;
|
||||||
import pp.dialog.SimpleDialog;
|
import pp.dialog.SimpleDialog;
|
||||||
|
|
||||||
import java.lang.System.Logger;
|
|
||||||
import java.lang.System.Logger.Level;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.Future;
|
|
||||||
|
|
||||||
import static pp.battleship.Resources.lookup;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a dialog for setting up a network connection in the Battleship game.
|
* Represents a dialog for setting up a network connection in the Battleship game.
|
||||||
* Allows users to specify the host and port for connecting to a game server.
|
* Allows users to specify the host and port for connecting to a game server.
|
||||||
@@ -32,7 +31,7 @@ import static pp.battleship.Resources.lookup;
|
|||||||
class NetworkDialog extends SimpleDialog {
|
class NetworkDialog extends SimpleDialog {
|
||||||
private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName());
|
private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName());
|
||||||
private static final String LOCALHOST = "localhost"; //NON-NLS
|
private static final String LOCALHOST = "localhost"; //NON-NLS
|
||||||
private static final String DEFAULT_PORT = "1234"; //NON-NLS
|
private static final String DEFAULT_PORT = "42069"; //NON-NLS
|
||||||
private final NetworkSupport network;
|
private final NetworkSupport network;
|
||||||
private final TextField host = new TextField(LOCALHOST);
|
private final TextField host = new TextField(LOCALHOST);
|
||||||
private final TextField port = new TextField(DEFAULT_PORT);
|
private final TextField port = new TextField(DEFAULT_PORT);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package pp.battleship.client.gui;
|
package pp.battleship.client.gui;
|
||||||
|
|
||||||
import com.simsilica.lemur.Slider;
|
import com.simsilica.lemur.Slider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The VolumeSlider class represents the Volume Slider in the Menu.
|
* The VolumeSlider class represents the Volume Slider in the Menu.
|
||||||
* It extends the Slider class and provides functionalities for setting the music volume,
|
* It extends the Slider class and provides functionalities for setting the music volume,
|
||||||
|
|||||||
@@ -7,12 +7,11 @@
|
|||||||
|
|
||||||
package pp.battleship;
|
package pp.battleship;
|
||||||
|
|
||||||
import pp.util.config.Config;
|
import static java.lang.Math.max;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import static java.lang.Math.max;
|
import pp.util.config.Config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to the configuration settings for the Battleship game.
|
* Provides access to the configuration settings for the Battleship game.
|
||||||
@@ -31,7 +30,7 @@ public class BattleshipConfig extends Config {
|
|||||||
* The default port number for the Battleship server.
|
* The default port number for the Battleship server.
|
||||||
*/
|
*/
|
||||||
@Property("port")
|
@Property("port")
|
||||||
private int port = 1234;
|
private int port = 12234;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The width of the game map in terms of grid units.
|
* The width of the game map in terms of grid units.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
# This file defines the configuration settings for the Battleship server.
|
# This file defines the configuration settings for the Battleship server.
|
||||||
#
|
#
|
||||||
# The port number on which the server will listen for incoming connections.
|
# The port number on which the server will listen for incoming connections.
|
||||||
port=1234
|
port=42069
|
||||||
#
|
#
|
||||||
# The dimensions of the game map.
|
# The dimensions of the game map.
|
||||||
# 'map.width' defines the number of columns, and 'map.height' defines the number of rows.
|
# 'map.width' defines the number of columns, and 'map.height' defines the number of rows.
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// Styling of Lemur components
|
// Styling of Lemur components
|
||||||
// For documentation, see:
|
// For documentation, see:
|
||||||
// https://github.com/jMonkeyEngine-Contributions/Lemur/wiki/Styling
|
// https://github.com/jMonkeyEngine-Contributions/Lemur/wiki/Styling
|
||||||
|
|
||||||
|
import com.jme3.math.ColorRGBA
|
||||||
import com.simsilica.lemur.*
|
import com.simsilica.lemur.*
|
||||||
import com.simsilica.lemur.component.QuadBackgroundComponent
|
import com.simsilica.lemur.component.QuadBackgroundComponent
|
||||||
import com.simsilica.lemur.Button
|
import com.simsilica.lemur.Button
|
||||||
@@ -19,7 +21,11 @@ def sliderColor = color(0.6, 0.8, 0.8, 1)
|
|||||||
def sliderBgColor = color(0.5, 0.75, 0.75, 1)
|
def sliderBgColor = color(0.5, 0.75, 0.75, 1)
|
||||||
def gradientColor = color(0.5, 0.75, 0.85, 0.5)
|
def gradientColor = color(0.5, 0.75, 0.85, 0.5)
|
||||||
def tabbuttonEnabledColor = color(0.4, 0.45, 0.5, 1)
|
def tabbuttonEnabledColor = color(0.4, 0.45, 0.5, 1)
|
||||||
def solidWhiteBackground = new QuadBackgroundComponent(color(1, 1, 1, 1)) // Solid white
|
def solidWhiteBackground = new QuadBackgroundComponent(new ColorRGBA(1, 1, 1, 1))
|
||||||
|
def greyBackground = new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 1.0f));
|
||||||
|
def lightGreyBackground = new QuadBackgroundComponent(new ColorRGBA(0.4f, 0.4f, 0.4f, 1.0f));
|
||||||
|
def lightGrey = color(0.6, 0.6, 0.6, 1.0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -32,9 +38,10 @@ def gradient = TbtQuadBackgroundComponent.create(
|
|||||||
def doubleGradient = new QuadBackgroundComponent(gradientColor)
|
def doubleGradient = new QuadBackgroundComponent(gradientColor)
|
||||||
doubleGradient.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
|
doubleGradient.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
|
||||||
generateMips: false)
|
generateMips: false)
|
||||||
|
//doubleGradient.color = color(0, 0, 0, 1)
|
||||||
|
|
||||||
def orangeBorder = TbtQuadBackgroundComponent.create(
|
def orangeBorder = TbtQuadBackgroundComponent.create(
|
||||||
texture(name: "/com/simsilica/lemur/icons/bordered-gradient.png", // Replace with an appropriate texture if needed
|
texture(name: "/com/simsilica/lemur/icons/border.png", // Replace with an appropriate texture if needed
|
||||||
generateMips: false),
|
generateMips: false),
|
||||||
1, 1, 1, 126, 126,
|
1, 1, 1, 126, 126,
|
||||||
1f, false)
|
1f, false)
|
||||||
@@ -49,11 +56,50 @@ selector("label", "pp") {
|
|||||||
color = buttonEnabledColor
|
color = buttonEnabledColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selector("label-Bold", "pp") {
|
||||||
|
insets = new Insets3f(2, 2, 2, 2)
|
||||||
|
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-32.fnt")
|
||||||
|
fontSize = 30
|
||||||
|
color = buttonEnabledColor
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
selector("label-toolbar", "pp") {
|
||||||
|
insets = new Insets3f(2, 2, 2, 2)
|
||||||
|
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-32.fnt")
|
||||||
|
fontSize = 30
|
||||||
|
color = new ColorRGBA(ColorRGBA.White)
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
|
|
||||||
|
}
|
||||||
|
selector("label-Text", "pp") {
|
||||||
|
insets = new Insets3f(2, 2, 2, 2)
|
||||||
|
fontSize = 25
|
||||||
|
color = buttonEnabledColor
|
||||||
|
}
|
||||||
|
|
||||||
|
selector("label-account", "pp") {
|
||||||
|
insets = new Insets3f(2, 2, 2, 2)
|
||||||
|
fontSize = 25
|
||||||
|
color = new ColorRGBA(ColorRGBA.White)
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
|
}
|
||||||
|
|
||||||
|
selector("card-label", "pp") {
|
||||||
|
insets = new Insets3f(2, 2, 2, 2)
|
||||||
|
color = ColorRGBA.Black
|
||||||
|
}
|
||||||
|
|
||||||
selector("header", "pp") {
|
selector("header", "pp") {
|
||||||
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-42.fnt")
|
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-42.fnt")
|
||||||
insets = new Insets3f(2, 2, 2, 2)
|
insets = new Insets3f(2, 2, 2, 2)
|
||||||
color = color(1, 0.5, 0, 1)
|
color = color(1, 0.5, 0, 1)
|
||||||
textHAlignment = HAlignment.Center
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
}
|
}
|
||||||
|
|
||||||
selector("container", "pp") {
|
selector("container", "pp") {
|
||||||
@@ -61,6 +107,12 @@ selector("container", "pp") {
|
|||||||
background.setColor(bgColor)
|
background.setColor(bgColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selector("toolbar") {
|
||||||
|
background = gradient.clone()
|
||||||
|
background.setColor(bgColor)
|
||||||
|
//color = (new ColorRGBA(0.4157f, 0.4235f, 0.4392f, 1.0f))
|
||||||
|
|
||||||
|
}
|
||||||
selector("slider", "pp") {
|
selector("slider", "pp") {
|
||||||
background = gradient.clone()
|
background = gradient.clone()
|
||||||
background.setColor(bgColor)
|
background.setColor(bgColor)
|
||||||
@@ -128,6 +180,8 @@ selector("title", "pp") {
|
|||||||
background.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
|
background.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
|
||||||
generateMips: false)
|
generateMips: false)
|
||||||
insets = new Insets3f(2, 2, 2, 2)
|
insets = new Insets3f(2, 2, 2, 2)
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
|
|
||||||
buttonCommands = stdButtonCommands
|
buttonCommands = stdButtonCommands
|
||||||
}
|
}
|
||||||
@@ -142,6 +196,8 @@ selector("button", "pp") {
|
|||||||
|
|
||||||
// Use insets to create a margin/padding effect for the inner background
|
// Use insets to create a margin/padding effect for the inner background
|
||||||
insets = new Insets3f(3, 3, 3, 3) // Adjust the border thickness
|
insets = new Insets3f(3, 3, 3, 3) // Adjust the border thickness
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
buttonCommands = stdButtonCommands
|
buttonCommands = stdButtonCommands
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,6 +246,7 @@ selector("slider.down.button", "pp") {
|
|||||||
|
|
||||||
selector("checkbox", "pp") {
|
selector("checkbox", "pp") {
|
||||||
color = buttonEnabledColor
|
color = buttonEnabledColor
|
||||||
|
fontSize = 20
|
||||||
}
|
}
|
||||||
|
|
||||||
selector("rollup", "pp") {
|
selector("rollup", "pp") {
|
||||||
@@ -213,3 +270,99 @@ selector("tab.button", "pp") {
|
|||||||
|
|
||||||
buttonCommands = stdButtonCommands
|
buttonCommands = stdButtonCommands
|
||||||
}
|
}
|
||||||
|
selector("settings-title", "pp") {
|
||||||
|
def outerBackground = new QuadBackgroundComponent(color(1, 0.5, 0, 1)) // Grey inner border
|
||||||
|
def innerBackground = new QuadBackgroundComponent(buttonBgColor) // White outer border background
|
||||||
|
|
||||||
|
background = outerBackground
|
||||||
|
fontSize = 40
|
||||||
|
insets = new Insets3f(3, 3, 3, 3)
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
|
}
|
||||||
|
selector("warning-title", "pp") {
|
||||||
|
def outerBackground = new QuadBackgroundComponent(color(1, 0.5, 0, 1)) // Grey inner border
|
||||||
|
def innerBackground = new QuadBackgroundComponent(buttonBgColor) // White outer border background
|
||||||
|
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-42.fnt")
|
||||||
|
background = outerBackground
|
||||||
|
fontSize = 40
|
||||||
|
insets = new Insets3f(3, 3, 3, 3)
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
|
}
|
||||||
|
|
||||||
|
selector("menu-button", "pp") {
|
||||||
|
fontSize = 40 // Set font size
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
|
buttonCommands = stdButtonCommands
|
||||||
|
}
|
||||||
|
|
||||||
|
// Style for Selector text
|
||||||
|
selector("selector.item.label") {
|
||||||
|
color = color(0, 0, 0, 1) // Black text
|
||||||
|
fontSize = 16 // Optional: Adjust the text size if needed
|
||||||
|
textHAlignment = HAlignment.Left // Optional: Align text to the left
|
||||||
|
insets = new Insets3f(2, 2, 2, 2) // Optional: Add padding around text
|
||||||
|
}
|
||||||
|
// Style the popup container background
|
||||||
|
selector("selector.popup") {
|
||||||
|
background = new QuadBackgroundComponent(new ColorRGBA(1, 1, 1, 0.8f)) // Translucent white background
|
||||||
|
insets = new Insets3f(5, 5, 5, 5) // Padding inside the popup container
|
||||||
|
}
|
||||||
|
|
||||||
|
// Style the text of dropdown options
|
||||||
|
selector("selector.item.label") {
|
||||||
|
color = color(0, 0, 0, 1) // Black text
|
||||||
|
fontSize = 16 // Optional: Adjust font size
|
||||||
|
textHAlignment = HAlignment.Left // Align text to the left
|
||||||
|
insets = new Insets3f(2, 5, 2, 5) // Add padding for each option
|
||||||
|
}
|
||||||
|
|
||||||
|
// Style the hover state of dropdown options
|
||||||
|
selector("selector.item.label", "hover") {
|
||||||
|
color = color(1, 1, 1, 1) // White text when hovered
|
||||||
|
background = new QuadBackgroundComponent(new ColorRGBA(0.2f, 0.6f, 1.0f, 0.9f)) // Highlighted background
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def enabledCommandToolbar = new Command<Button>() {
|
||||||
|
void execute(Button source) {
|
||||||
|
if (source.isEnabled()){
|
||||||
|
source.setColor(ColorRGBA.White)
|
||||||
|
def orangeBackground = new QuadBackgroundComponent(color(1, 0.5, 0, 1)); // Orange background
|
||||||
|
source.setBackground(orangeBackground);
|
||||||
|
} else{
|
||||||
|
source.setColor(ColorRGBA.White)
|
||||||
|
def grayBackground = new QuadBackgroundComponent(ColorRGBA.Gray); // Gray background
|
||||||
|
source.setBackground(grayBackground);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def stdButtonCommandsToolbar = [
|
||||||
|
(ButtonAction.Down) : [pressedCommand],
|
||||||
|
(ButtonAction.Up) : [pressedCommand],
|
||||||
|
(ButtonAction.Enabled) : [enabledCommandToolbar],
|
||||||
|
(ButtonAction.Disabled): [enabledCommandToolbar]
|
||||||
|
]
|
||||||
|
|
||||||
|
selector("button-toolbar", "pp") {
|
||||||
|
def outerBackground = new QuadBackgroundComponent(color(1, 0.5, 0, 1)) // Orange border
|
||||||
|
def innerBackground = new QuadBackgroundComponent(buttonBgColor) // Inner button background
|
||||||
|
|
||||||
|
// Apply the outer border as the main background
|
||||||
|
background = outerBackground
|
||||||
|
|
||||||
|
// Use insets to create a margin/padding effect for the inner background
|
||||||
|
insets = new Insets3f(3, 3, 3, 3) // Adjust the border thickness
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
|
buttonCommands = stdButtonCommandsToolbar
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,14 @@ description = 'Monopoly Client'
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation project(":jme-common")
|
implementation project(":jme-common")
|
||||||
implementation project(":monopoly:model")
|
implementation project(":monopoly:model")
|
||||||
|
implementation project(":monopoly:server")
|
||||||
|
|
||||||
|
implementation 'com.simsilica:lemur-proto:1.13.0'
|
||||||
implementation libs.jme3.desktop
|
implementation libs.jme3.desktop
|
||||||
|
implementation libs.lemur
|
||||||
|
implementation libs.lemurproto
|
||||||
|
|
||||||
|
implementation libs.selenium
|
||||||
|
|
||||||
runtimeOnly libs.jme3.awt.dialogs
|
runtimeOnly libs.jme3.awt.dialogs
|
||||||
runtimeOnly libs.jme3.plugins
|
runtimeOnly libs.jme3.plugins
|
||||||
|
|||||||
@@ -5,47 +5,13 @@
|
|||||||
## (c) Mark Minas (mark.minas@unibw.de)
|
## (c) Mark Minas (mark.minas@unibw.de)
|
||||||
########################################
|
########################################
|
||||||
#
|
#
|
||||||
# Battleship client configuration
|
# Monopoly client configuration
|
||||||
#
|
|
||||||
# Specifies the map used by the opponent in single mode.
|
|
||||||
# Single mode is activated if this property is set.
|
|
||||||
#map.opponent=maps/map2.json
|
|
||||||
#
|
|
||||||
# Specifies the map used by the player in single mode.
|
|
||||||
# The player must define their own map if this property is not set.
|
|
||||||
map.own=maps/map1.json
|
|
||||||
#
|
|
||||||
# Coordinates of the shots fired by the RobotClient in the order listed.
|
|
||||||
# Example:
|
|
||||||
# 2, 0,\
|
|
||||||
# 2, 1,\
|
|
||||||
# 2, 2,\
|
|
||||||
# 2, 3
|
|
||||||
# defines four shots, namely at the coordinates
|
|
||||||
# (x=2, y=0), (x=2, y=1), (x=2, y=2), and (x=2, y=3)
|
|
||||||
robot.targets=2, 0,\
|
|
||||||
2, 1,\
|
|
||||||
2, 2,\
|
|
||||||
2, 3
|
|
||||||
#
|
|
||||||
# Delay in milliseconds between each shot fired by the RobotClient.
|
|
||||||
robot.delay=500
|
|
||||||
#
|
#
|
||||||
# The dimensions of the game map used in single mode.
|
# The dimensions of the game map used in single mode.
|
||||||
# 'map.width' defines the number of columns, and 'map.height' defines the number of rows.
|
# 'map.width' defines the number of columns, and 'map.height' defines the number of rows.
|
||||||
map.width=10
|
map.width=10
|
||||||
map.height=10
|
map.height=10
|
||||||
#
|
#
|
||||||
# The number of ships of each length available in single mode.
|
|
||||||
# The value is a comma-separated list where each element corresponds to the number of ships
|
|
||||||
# with a specific length. For example:
|
|
||||||
# ship.nums=4, 3, 2, 1
|
|
||||||
# This configuration means:
|
|
||||||
# - 4 ships of length 1
|
|
||||||
# - 3 ships of length 2
|
|
||||||
# - 2 ships of length 3
|
|
||||||
# - 1 ship of length 4
|
|
||||||
ship.nums=4, 3, 2, 1
|
|
||||||
#
|
#
|
||||||
# Screen settings
|
# Screen settings
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
////////////////////////////////////////
|
||||||
|
// Programming project code
|
||||||
|
// UniBw M, 2022, 2023, 2024
|
||||||
|
// www.unibw.de/inf2
|
||||||
|
// (c) Mark Minas (mark.minas@unibw.de)
|
||||||
|
////////////////////////////////////////
|
||||||
|
|
||||||
|
package pp.monopoly.client;
|
||||||
|
|
||||||
|
import java.lang.System.Logger;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.jme3.input.controls.ActionListener;
|
||||||
|
import com.jme3.scene.Node;
|
||||||
|
import com.jme3.system.AppSettings;
|
||||||
|
|
||||||
|
import pp.monopoly.client.gui.TestWorld;
|
||||||
|
import pp.monopoly.game.server.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the state responsible for managing the battle interface within the Battleship game.
|
||||||
|
* This state handles the display and interaction of the battle map, including the opponent's map.
|
||||||
|
* It manages GUI components, input events, and the layout of the interface when this state is enabled.
|
||||||
|
*/
|
||||||
|
public class GameAppState extends MonopolyAppState {
|
||||||
|
private static final Logger LOGGER = System.getLogger(MonopolyAppState.class.getName());
|
||||||
|
private static final float DEPTH = 0f;
|
||||||
|
private static final float GAP = 20f;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A listener for handling click events in the battle interface.
|
||||||
|
* When a click is detected, it triggers the corresponding actions on the opponent's map.
|
||||||
|
*/
|
||||||
|
private final ActionListener clickListener = (name, isPressed, tpf) -> click(isPressed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The root node for all GUI components in the battle state.
|
||||||
|
*/
|
||||||
|
private final Node battleNode = new Node("Game"); //NON-NLS
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A view representing the opponent's map in the GUI.
|
||||||
|
*/
|
||||||
|
private TestWorld testWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the battle state by initializing, laying out, and adding GUI components.
|
||||||
|
* Attaches the components to the GUI node and registers input listeners.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void enableState() {
|
||||||
|
battleNode.detachAllChildren();
|
||||||
|
initializeGuiComponents();
|
||||||
|
layoutGuiComponents();
|
||||||
|
addGuiComponents();
|
||||||
|
getApp().getGuiNode().attachChild(battleNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables the battle state by removing GUI components and unregistering input listeners.
|
||||||
|
* Also handles cleanup of resources, such as the opponent's map view.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void disableState() {
|
||||||
|
getApp().getGuiNode().detachChild(battleNode);
|
||||||
|
getApp().getInputManager().removeListener(clickListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the GUI components used in the battle state.
|
||||||
|
* Creates the opponent's map view and adds a grid overlay to it.
|
||||||
|
*/
|
||||||
|
private void initializeGuiComponents() {
|
||||||
|
|
||||||
|
// Initialisiere TestWorld mit Spielern
|
||||||
|
testWorld = new TestWorld(getApp());
|
||||||
|
testWorld.initializeScene();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the initialized GUI components to the battle node.
|
||||||
|
* Currently, it attaches the opponent's map view to the node.
|
||||||
|
*/
|
||||||
|
private void addGuiComponents() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lays out the GUI components within the window, positioning them appropriately.
|
||||||
|
* The opponent's map view is positioned based on the window's dimensions and a specified gap.
|
||||||
|
*/
|
||||||
|
private void layoutGuiComponents() {
|
||||||
|
final AppSettings s = getApp().getContext().getSettings();
|
||||||
|
final float windowWidth = s.getWidth();
|
||||||
|
final float windowHeight = s.getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles click events in the battle interface. If the event indicates a click (not a release),
|
||||||
|
* it translates the cursor position to the model's coordinate system and triggers the game logic
|
||||||
|
* for interacting with the opponent's map.
|
||||||
|
*
|
||||||
|
* @param isPressed whether the mouse button is currently pressed (true) or released (false)
|
||||||
|
*/
|
||||||
|
private void click(boolean isPressed) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(float tpf) {
|
||||||
|
// testWorld.update(tpf);
|
||||||
|
super.update(tpf);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package pp.monopoly.client;
|
||||||
|
|
||||||
|
import static pp.util.PreferencesUtils.getPreferences;
|
||||||
|
|
||||||
|
import java.lang.System.Logger;
|
||||||
|
import java.lang.System.Logger.Level;
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
|
import com.jme3.app.Application;
|
||||||
|
import com.jme3.app.state.AbstractAppState;
|
||||||
|
import com.jme3.app.state.AppStateManager;
|
||||||
|
import com.jme3.asset.AssetLoadException;
|
||||||
|
import com.jme3.asset.AssetNotFoundException;
|
||||||
|
import com.jme3.audio.AudioData;
|
||||||
|
import com.jme3.audio.AudioNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the background music beeing played. Is able to start and stop the music. Set the Volume of the Audio.
|
||||||
|
*/
|
||||||
|
public class GameMusic extends AbstractAppState{
|
||||||
|
private static final Logger LOGGER = System.getLogger(GameMusic.class.getName());
|
||||||
|
private static final Preferences PREFERENCES = getPreferences(GameMusic.class);
|
||||||
|
private static final String ENABLED_PREF = "enabled"; //NON-NLS
|
||||||
|
private static final String VOLUME_PREF = "volume"; //NON-NLS
|
||||||
|
|
||||||
|
private AudioNode music;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if sound is enabled in the preferences.
|
||||||
|
*
|
||||||
|
* @return {@code true} if sound is enabled, {@code false} otherwise.
|
||||||
|
*/
|
||||||
|
public static boolean enabledInPreferences() {
|
||||||
|
return PREFERENCES.getBoolean(ENABLED_PREF, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if sound is enabled in the preferences.
|
||||||
|
*
|
||||||
|
* @return float to which the volume is set
|
||||||
|
*/
|
||||||
|
public static float volumeInPreferences() {
|
||||||
|
return PREFERENCES.getFloat(VOLUME_PREF, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the sound effects for the game.
|
||||||
|
* Overrides {@link AbstractAppState#initialize(AppStateManager, Application)}
|
||||||
|
*
|
||||||
|
* @param stateManager The state manager
|
||||||
|
* @param app The application
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void initialize(AppStateManager stateManager, Application app) {
|
||||||
|
super.initialize(stateManager, app);
|
||||||
|
music = loadSound(app, "Sound/background.ogg");
|
||||||
|
setVolume(volumeInPreferences());
|
||||||
|
music.setLooping(true);
|
||||||
|
if (isEnabled() && music != null) {
|
||||||
|
music.play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a sound from the specified file.
|
||||||
|
*
|
||||||
|
* @param app The application
|
||||||
|
* @param name The name of the sound file.
|
||||||
|
* @return The loaded AudioNode.
|
||||||
|
*/
|
||||||
|
private AudioNode loadSound(Application app, String name) {
|
||||||
|
try {
|
||||||
|
final AudioNode sound = new AudioNode(app.getAssetManager(), name, AudioData.DataType.Buffer);
|
||||||
|
sound.setLooping(false);
|
||||||
|
sound.setPositional(false);
|
||||||
|
return sound;
|
||||||
|
}
|
||||||
|
catch (AssetLoadException | AssetNotFoundException ex) {
|
||||||
|
LOGGER.log(Level.ERROR, ex.getMessage(), ex);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the enabled state of this AppState.
|
||||||
|
* Overrides {@link com.jme3.app.state.AbstractAppState#setEnabled(boolean)}
|
||||||
|
*
|
||||||
|
* @param enabled {@code true} to enable the AppState, {@code false} to disable it.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
if (isEnabled() == enabled) return;
|
||||||
|
|
||||||
|
if (music != null) {
|
||||||
|
if (enabled) {
|
||||||
|
music.play();
|
||||||
|
} else {
|
||||||
|
music.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.setEnabled(enabled);
|
||||||
|
LOGGER.log(Level.INFO, "Sound enabled: {0}", enabled); //NON-NLS
|
||||||
|
PREFERENCES.putBoolean(ENABLED_PREF, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles the game sound on or off.
|
||||||
|
*/
|
||||||
|
public void toggleSound() {
|
||||||
|
setEnabled(!isEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the volume of music
|
||||||
|
* @param vol the volume to which the music should be set
|
||||||
|
*/
|
||||||
|
public void setVolume(float vol){
|
||||||
|
music.setVolume(vol);
|
||||||
|
PREFERENCES.putFloat(VOLUME_PREF, vol);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,10 +30,19 @@ public class GameSound extends AbstractAppState implements GameEventListener {
|
|||||||
private static final Logger LOGGER = System.getLogger(GameSound.class.getName());
|
private static final Logger LOGGER = System.getLogger(GameSound.class.getName());
|
||||||
private static final Preferences PREFERENCES = getPreferences(GameSound.class);
|
private static final Preferences PREFERENCES = getPreferences(GameSound.class);
|
||||||
private static final String ENABLED_PREF = "enabled"; //NON-NLS
|
private static final String ENABLED_PREF = "enabled"; //NON-NLS
|
||||||
|
private static final String VOLUME_PREF = "volume"; //NON-NLS
|
||||||
|
|
||||||
private AudioNode splashSound;
|
private AudioNode passStartSound;
|
||||||
private AudioNode shipDestroyedSound;
|
private AudioNode eventCardSound;
|
||||||
private AudioNode explosionSound;
|
private AudioNode gulagSound;
|
||||||
|
private AudioNode diceRollSound;
|
||||||
|
private AudioNode moneyCollectSound;
|
||||||
|
private AudioNode moneyLostSound;
|
||||||
|
private AudioNode tradeAcceptedSound;
|
||||||
|
private AudioNode tradeRejectedSound;
|
||||||
|
private AudioNode winnerSound;
|
||||||
|
private AudioNode looserSound;
|
||||||
|
private AudioNode buttonSound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if sound is enabled in the preferences.
|
* Checks if sound is enabled in the preferences.
|
||||||
@@ -51,6 +60,15 @@ public class GameSound extends AbstractAppState implements GameEventListener {
|
|||||||
setEnabled(!isEnabled());
|
setEnabled(!isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if sound is enabled in the preferences.
|
||||||
|
*
|
||||||
|
* @return float to which the volume is set
|
||||||
|
*/
|
||||||
|
public static float volumeInPreferences() {
|
||||||
|
return PREFERENCES.getFloat(VOLUME_PREF, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the enabled state of this AppState.
|
* Sets the enabled state of this AppState.
|
||||||
* Overrides {@link com.jme3.app.state.AbstractAppState#setEnabled(boolean)}
|
* Overrides {@link com.jme3.app.state.AbstractAppState#setEnabled(boolean)}
|
||||||
@@ -75,6 +93,17 @@ public class GameSound extends AbstractAppState implements GameEventListener {
|
|||||||
@Override
|
@Override
|
||||||
public void initialize(AppStateManager stateManager, Application app) {
|
public void initialize(AppStateManager stateManager, Application app) {
|
||||||
super.initialize(stateManager, app);
|
super.initialize(stateManager, app);
|
||||||
|
passStartSound = loadSound(app, "Sound/Effects/passStart.ogg");
|
||||||
|
eventCardSound = loadSound(app, "Sound/Effects/eventCard.ogg");
|
||||||
|
gulagSound = loadSound(app, "Sound/Effects/gulag.ogg");
|
||||||
|
diceRollSound = loadSound(app, "Sound/Effects/diceRoll.ogg");
|
||||||
|
moneyCollectSound = loadSound(app, "Sound/Effects/moneyCollect.ogg");
|
||||||
|
moneyLostSound = loadSound(app, "Sound/Effects/moneyLost.ogg");
|
||||||
|
tradeAcceptedSound = loadSound(app, "Sound/Effects/tradeAccepted.ogg");
|
||||||
|
tradeRejectedSound = loadSound(app, "Sound/Effects/tradeRejected.ogg");
|
||||||
|
winnerSound = loadSound(app, "Sound/Effects/winner.ogg");
|
||||||
|
looserSound = loadSound(app, "Sound/Effects/loser.ogg");
|
||||||
|
buttonSound = loadSound(app, "Sound/Effects/button.ogg");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,32 +127,116 @@ public class GameSound extends AbstractAppState implements GameEventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays the splash sound effect.
|
* Plays the passStart sound effect.
|
||||||
*/
|
*/
|
||||||
public void splash() {
|
public void passStart() {
|
||||||
if (isEnabled() && splashSound != null)
|
if (isEnabled() && passStartSound != null)
|
||||||
splashSound.playInstance();
|
passStartSound.playInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays the explosion sound effect.
|
* Plays the eventCard sound effect.
|
||||||
*/
|
*/
|
||||||
public void explosion() {
|
public void eventCard() {
|
||||||
if (isEnabled() && explosionSound != null)
|
if (isEnabled() && eventCardSound != null)
|
||||||
explosionSound.playInstance();
|
eventCardSound.playInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays sound effect when a ship has been destroyed.
|
* Plays the gulag sound effect.
|
||||||
*/
|
*/
|
||||||
public void shipDestroyed() {
|
public void gulag() {
|
||||||
if (isEnabled() && shipDestroyedSound != null)
|
if (isEnabled() && gulagSound != null)
|
||||||
shipDestroyedSound.playInstance();
|
gulagSound.playInstance();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Plays the diceRoll sound effect.
|
||||||
|
*/
|
||||||
|
public void diceRoll() {
|
||||||
|
if (isEnabled() && diceRollSound != null)
|
||||||
|
diceRollSound.playInstance();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Plays the moneyCollect sound effect.
|
||||||
|
*/
|
||||||
|
public void moneyCollect() {
|
||||||
|
if (isEnabled() && moneyCollectSound != null)
|
||||||
|
moneyCollectSound.playInstance();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Plays the moneyLost sound effect.
|
||||||
|
*/
|
||||||
|
public void moneyLost() {
|
||||||
|
if (isEnabled() && moneyLostSound != null)
|
||||||
|
moneyLostSound.playInstance();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Plays the tradeAccepted sound effect.
|
||||||
|
*/
|
||||||
|
public void tradeAccepted() {
|
||||||
|
if (isEnabled() && tradeAcceptedSound != null)
|
||||||
|
tradeAcceptedSound.playInstance();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Plays the tradeRejected sound effect.
|
||||||
|
*/
|
||||||
|
public void tradeRejected() {
|
||||||
|
if (isEnabled() && tradeRejectedSound != null)
|
||||||
|
tradeRejectedSound.playInstance();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Plays the winner sound effect.
|
||||||
|
*/
|
||||||
|
public void winner() {
|
||||||
|
if (isEnabled() && winnerSound != null)
|
||||||
|
winnerSound.playInstance();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Plays the looser sound effect.
|
||||||
|
*/
|
||||||
|
public void looser() {
|
||||||
|
if (isEnabled() && looserSound != null)
|
||||||
|
looserSound.playInstance();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Plays the button sound effect.
|
||||||
|
*/
|
||||||
|
public void button() {
|
||||||
|
if (isEnabled() && buttonSound != null)
|
||||||
|
buttonSound.playInstance();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Sets the volume of the sounds
|
||||||
|
* @param vol the volume to which the sounds should be set
|
||||||
|
*/
|
||||||
|
public void setVolume(float vol){
|
||||||