diff --git a/Projekte/.run/MonopolyApp (Mac).run.xml b/Projekte/.run/MonopolyApp (Mac).run.xml
new file mode 100644
index 0000000..95dd7c1
--- /dev/null
+++ b/Projekte/.run/MonopolyApp (Mac).run.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Projekte/.run/MonopolyApp.run.xml b/Projekte/.run/MonopolyApp.run.xml
new file mode 100644
index 0000000..ccd1e2f
--- /dev/null
+++ b/Projekte/.run/MonopolyApp.run.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Projekte/.run/MonopolyServer.run.xml b/Projekte/.run/MonopolyServer.run.xml
new file mode 100644
index 0000000..d892cf3
--- /dev/null
+++ b/Projekte/.run/MonopolyServer.run.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Projekte/battleship/client/src/main/java/pp/battleship/client/Menu.java b/Projekte/battleship/client/src/main/java/pp/battleship/client/Menu.java
index 44a9a74..12afb6d 100644
--- a/Projekte/battleship/client/src/main/java/pp/battleship/client/Menu.java
+++ b/Projekte/battleship/client/src/main/java/pp/battleship/client/Menu.java
@@ -18,10 +18,11 @@ import com.simsilica.lemur.style.ElementId;
import static pp.battleship.Resources.lookup;
import pp.battleship.client.gui.GameMusic;
-import pp.battleship.client.gui.VolumeSlider;
import pp.dialog.Dialog;
import pp.dialog.StateCheckboxModel;
import pp.dialog.TextInputDialog;
+import pp.battleship.client.gui.VolumeSlider;
+
import static pp.util.PreferencesUtils.getPreferences;
/**
diff --git a/Projekte/battleship/client/src/main/java/pp/battleship/client/NetworkDialog.java b/Projekte/battleship/client/src/main/java/pp/battleship/client/NetworkDialog.java
index 2e043c1..d9dde65 100644
--- a/Projekte/battleship/client/src/main/java/pp/battleship/client/NetworkDialog.java
+++ b/Projekte/battleship/client/src/main/java/pp/battleship/client/NetworkDialog.java
@@ -7,24 +7,23 @@
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.Container;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.TextField;
import com.simsilica.lemur.component.SpringGridLayout;
+import static pp.battleship.Resources.lookup;
import pp.battleship.server.BattleshipServer;
import pp.dialog.Dialog;
import pp.dialog.DialogBuilder;
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.
* 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 {
private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName());
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 TextField host = new TextField(LOCALHOST);
private final TextField port = new TextField(DEFAULT_PORT);
diff --git a/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeSlider.java b/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeSlider.java
index aa27292..70f9097 100644
--- a/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeSlider.java
+++ b/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeSlider.java
@@ -1,6 +1,7 @@
package pp.battleship.client.gui;
import com.simsilica.lemur.Slider;
+
/**
* The VolumeSlider class represents the Volume Slider in the Menu.
* It extends the Slider class and provides functionalities for setting the music volume,
diff --git a/Projekte/battleship/model/src/main/java/pp/battleship/BattleshipConfig.java b/Projekte/battleship/model/src/main/java/pp/battleship/BattleshipConfig.java
index f6b4cf2..af4c63d 100644
--- a/Projekte/battleship/model/src/main/java/pp/battleship/BattleshipConfig.java
+++ b/Projekte/battleship/model/src/main/java/pp/battleship/BattleshipConfig.java
@@ -7,12 +7,11 @@
package pp.battleship;
-import pp.util.config.Config;
-
+import static java.lang.Math.max;
import java.util.Map;
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.
@@ -31,7 +30,7 @@ public class BattleshipConfig extends Config {
* The default port number for the Battleship server.
*/
@Property("port")
- private int port = 1234;
+ private int port = 12234;
/**
* The width of the game map in terms of grid units.
diff --git a/Projekte/battleship/server/server.properties b/Projekte/battleship/server/server.properties
index 9f168a6..1a03cec 100644
--- a/Projekte/battleship/server/server.properties
+++ b/Projekte/battleship/server/server.properties
@@ -10,7 +10,7 @@
# This file defines the configuration settings for the Battleship server.
#
# The port number on which the server will listen for incoming connections.
-port=1234
+port=42069
#
# The dimensions of the game map.
# 'map.width' defines the number of columns, and 'map.height' defines the number of rows.
diff --git a/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy b/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy
index 3ad66c1..398fdf1 100644
--- a/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy
+++ b/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy
@@ -1,6 +1,8 @@
// Styling of Lemur components
// For documentation, see:
// https://github.com/jMonkeyEngine-Contributions/Lemur/wiki/Styling
+
+import com.jme3.math.ColorRGBA
import com.simsilica.lemur.*
import com.simsilica.lemur.component.QuadBackgroundComponent
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 gradientColor = color(0.5, 0.75, 0.85, 0.5)
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)
doubleGradient.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
generateMips: false)
+//doubleGradient.color = color(0, 0, 0, 1)
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),
1, 1, 1, 126, 126,
1f, false)
@@ -49,11 +56,27 @@ selector("label", "pp") {
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-Text", "pp") {
+ insets = new Insets3f(2, 2, 2, 2)
+ fontSize = 25
+ color = buttonEnabledColor
+}
+
selector("header", "pp") {
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-42.fnt")
insets = new Insets3f(2, 2, 2, 2)
color = color(1, 0.5, 0, 1)
textHAlignment = HAlignment.Center
+ textVAlignment = VAlignment.Center
}
selector("container", "pp") {
@@ -62,20 +85,10 @@ selector("container", "pp") {
}
selector("toolbar") {
- // Set the grey background
- background = new QuadBackgroundComponent(greyBackground)
+ background = gradient.clone()
+ background.setColor(bgColor)
+ //color = (new ColorRGBA(0.4157f, 0.4235f, 0.4392f, 1.0f))
- // Add a red border using a TbtQuadBackgroundComponent
- def redBorder = TbtQuadBackgroundComponent.create(
- texture(name: "/com/simsilica/lemur/icons/bordered-gradient.png",
- generateMips: false),
- 1, 1, 1, 1, 1,
- 1f, false)
- redBorder.color = redBorderColor
- background = greyBackground
-
- // Optional: Set padding inside the toolbar
- insets = new Insets3f(10, 10, 10, 10)
}
selector("slider", "pp") {
background = gradient.clone()
@@ -144,6 +157,8 @@ selector("title", "pp") {
background.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
generateMips: false)
insets = new Insets3f(2, 2, 2, 2)
+ textHAlignment = HAlignment.Center
+ textVAlignment = VAlignment.Center
buttonCommands = stdButtonCommands
}
@@ -158,6 +173,8 @@ selector("button", "pp") {
// 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 = stdButtonCommands
}
@@ -231,6 +248,47 @@ selector("tab.button", "pp") {
buttonCommands = stdButtonCommands
}
selector("settings-title", "pp") {
- fontSize = 48 // Set font size
- background = new QuadBackgroundComponent(color(0.4157f, 0.4235f, 0.4392f, 1.0f)) // Grey background
- }
\ No newline at end of file
+ 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("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
+}
+
diff --git a/Projekte/monopoly/client/build.gradle b/Projekte/monopoly/client/build.gradle
index 66985e3..85ddd4b 100644
--- a/Projekte/monopoly/client/build.gradle
+++ b/Projekte/monopoly/client/build.gradle
@@ -9,7 +9,12 @@ dependencies {
implementation project(":monopoly:model")
implementation project(":monopoly:server")
+ implementation 'com.simsilica:lemur-proto:1.13.0'
implementation libs.jme3.desktop
+ implementation libs.lemur
+ implementation libs.lemurproto
+
+ implementation libs.selenium
runtimeOnly libs.jme3.awt.dialogs
runtimeOnly libs.jme3.plugins
diff --git a/Projekte/monopoly/client/client.properties b/Projekte/monopoly/client/client.properties
index 4403fa3..3e2d911 100644
--- a/Projekte/monopoly/client/client.properties
+++ b/Projekte/monopoly/client/client.properties
@@ -5,47 +5,13 @@
## (c) Mark Minas (mark.minas@unibw.de)
########################################
#
-# Battleship 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
+# Monopoly client configuration
#
# 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=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
#
diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/GameMusic.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/GameMusic.java
new file mode 100644
index 0000000..1e6f94e
--- /dev/null
+++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/GameMusic.java
@@ -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);
+ }
+}
diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/GameSound.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/GameSound.java
index bf5d649..2722afa 100644
--- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/GameSound.java
+++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/GameSound.java
@@ -30,10 +30,19 @@ public class GameSound extends AbstractAppState implements GameEventListener {
private static final Logger LOGGER = System.getLogger(GameSound.class.getName());
private static final Preferences PREFERENCES = getPreferences(GameSound.class);
private static final String ENABLED_PREF = "enabled"; //NON-NLS
+ private static final String VOLUME_PREF = "volume"; //NON-NLS
- private AudioNode splashSound;
- private AudioNode shipDestroyedSound;
- private AudioNode explosionSound;
+ private AudioNode passStartSound;
+ private AudioNode eventCardSound;
+ 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.
@@ -51,6 +60,15 @@ public class GameSound extends AbstractAppState implements GameEventListener {
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.
* Overrides {@link com.jme3.app.state.AbstractAppState#setEnabled(boolean)}
@@ -75,6 +93,17 @@ public class GameSound extends AbstractAppState implements GameEventListener {
@Override
public void initialize(AppStateManager stateManager, Application 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() {
- if (isEnabled() && splashSound != null)
- splashSound.playInstance();
+ public void passStart() {
+ if (isEnabled() && passStartSound != null)
+ passStartSound.playInstance();
}
-
/**
- * Plays the explosion sound effect.
+ * Plays the eventCard sound effect.
*/
- public void explosion() {
- if (isEnabled() && explosionSound != null)
- explosionSound.playInstance();
+ public void eventCard() {
+ if (isEnabled() && eventCardSound != null)
+ eventCardSound.playInstance();
}
-
/**
- * Plays sound effect when a ship has been destroyed.
+ * Plays the gulag sound effect.
*/
- public void shipDestroyed() {
- if (isEnabled() && shipDestroyedSound != null)
- shipDestroyedSound.playInstance();
+ public void gulag() {
+ if (isEnabled() && gulagSound != null)
+ 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){
+ passStartSound.setVolume(vol);
+ eventCardSound.setVolume(vol);
+ gulagSound.setVolume(vol);
+ diceRollSound.setVolume(vol);
+ moneyCollectSound.setVolume(vol);
+ moneyLostSound.setVolume(vol);
+ tradeAcceptedSound.setVolume(vol);
+ tradeRejectedSound.setVolume(vol);
+ winnerSound.setVolume(vol);
+ looserSound.setVolume(vol);
+ buttonSound.setVolume(vol);
+
+ PREFERENCES.putFloat(VOLUME_PREF, vol);
}
@Override
public void receivedEvent(SoundEvent event) {
switch (event.sound()) {
+ case PASS_START -> passStart();
+ case EVENT_CARD -> eventCard();
+ case GULAG -> gulag();
+ case DICE_ROLL -> diceRoll();
+ case MONEY_COLLECTED -> moneyCollect();
+ case MONEY_LOST -> moneyLost();
+ case TRADE_ACCEPTED -> tradeAccepted();
+ case TRADE_REJECTED -> tradeRejected();
+ case WINNER -> winner();
+ case LOSER -> looser();
+ case BUTTON -> button();
}
}
}
diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/Menu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/Menu.java
deleted file mode 100644
index a9a22e5..0000000
--- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/Menu.java
+++ /dev/null
@@ -1,51 +0,0 @@
-////////////////////////////////////////
-// 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.util.prefs.Preferences;
-
-import pp.dialog.Dialog;
-import static pp.util.PreferencesUtils.getPreferences;
-
-/**
- * The Menu class represents the main menu in the Battleship game application.
- * It extends the Dialog class and provides functionalities for loading, saving,
- * returning to the game, and quitting the application.
- */
-class Menu extends Dialog {
- private static final Preferences PREFERENCES = getPreferences(Menu.class);
- private static final String LAST_PATH = "last.file.path";
- private final MonopolyApp app;
-
-
- /**
- * Constructs the Menu dialog for the Battleship application.
- *
- * @param app the BattleshipApp instance
- */
- public Menu(MonopolyApp app) {
- super(app.getDialogManager());
- this.app = app;
- }
-
- /**
- * Updates the state of the load and save buttons based on the game logic.
- */
- @Override
- public void update() {
-
- }
-
- /**
- * As an escape action, this method closes the menu if it is the top dialog.
- */
- @Override
- public void escape() {
- close();
- }
-}
diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java
index 02f926d..186425a 100644
--- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java
+++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java
@@ -1,210 +1,506 @@
+////////////////////////////////////////
+// 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.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
+import com.jme3.app.DebugKeysAppState;
import com.jme3.app.SimpleApplication;
+import com.jme3.app.StatsAppState;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.input.KeyInput;
+import com.jme3.input.MouseInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
+import com.jme3.input.controls.MouseButtonTrigger;
import com.jme3.system.AppSettings;
import com.simsilica.lemur.GuiGlobals;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.style.BaseStyles;
-
+import pp.monopoly.game.client.MonopolyClient;
+import pp.monopoly.client.gui.SettingsMenu;
+import pp.monopoly.client.gui.StartMenu;
+import pp.monopoly.client.gui.TestWorld;
+import pp.monopoly.client.gui.popups.BuildingPropertyCard;
+import pp.monopoly.client.gui.popups.BuyCard;
+import pp.monopoly.client.gui.popups.EventCard;
+import pp.monopoly.client.gui.popups.FoodFieldCard;
+import pp.monopoly.client.gui.popups.GateFieldCard;
+import pp.monopoly.game.client.ClientGameLogic;
+import pp.monopoly.game.client.ServerConnection;
+import pp.monopoly.notification.ClientStateEvent;
+import pp.monopoly.notification.GameEventListener;
+import pp.monopoly.notification.InfoTextEvent;
+import pp.monopoly.notification.Sound;
+import pp.dialog.Dialog;
import pp.dialog.DialogBuilder;
import pp.dialog.DialogManager;
import pp.graphics.Draw;
-import pp.monopoly.client.gui.SettingsMenu;
-import pp.monopoly.client.gui.TestWorld;
-import pp.monopoly.game.client.ClientGameLogic;
-import pp.monopoly.game.client.MonopolyClient;
-import pp.monopoly.game.client.ServerConnection;
-import pp.monopoly.notification.GameEventListener;
-import pp.monopoly.notification.InfoTextEvent;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.logging.LogManager;
+
+import static pp.monopoly.Resources.lookup;
+
+/**
+ * The main class for the Battleship client application.
+ * It manages the initialization, input setup, GUI setup, and game states for the client.
+ */
public class MonopolyApp extends SimpleApplication implements MonopolyClient, GameEventListener {
- private BitmapText topText;
- private final ServerConnection serverConnection;
- private final ClientGameLogic logic;
- private final MonopolyAppConfig config;
- private final ActionListener escapeListener = (name, isPressed, tpf) -> handleEscape(isPressed);
- private final DialogManager dialogManager = new DialogManager(this);
- private final ExecutorService executor = Executors.newCachedThreadPool();
- private final Draw draw;
- private SettingsMenu settingsMenu;
- private TestWorld testWorld;
- private boolean isSettingsMenuOpen = false;
- private boolean inputBlocked = false;
+
+ /**
+ * Logger for logging messages within the application.
+ */
+ private static final Logger LOGGER = System.getLogger(MonopolyApp.class.getName());
+
/**
* Path to the styles script for GUI elements.
*/
private static final String STYLES_SCRIPT = "Interface/Lemur/pp-styles.groovy"; //NON-NLS
+
/**
* Path to the font resource used in the GUI.
*/
private static final String FONT = "Interface/Fonts/Default.fnt"; //NON-NLS
+ /**
+ * Path to the client configuration file, if one exists.
+ */
+ private static final File CONFIG_FILE = new File("client.properties");
+ /**
+ * Input mapping name for mouse clicks.
+ */
+ public static final String CLICK = "CLICK";
+
+ /**
+ * Input mapping name for the Escape key.
+ */
+ private static final String ESC = "ESC";
+
+ /**
+ * Manager for handling dialogs within the application.
+ */
+ private final DialogManager dialogManager = new DialogManager(this);
+
+ /**
+ * The server connection instance, used for communicating with the game server.
+ */
+ private final ServerConnection serverConnection;
+
+ /**
+ * Instance of the {@link Draw} class for rendering graphics.
+ */
+ private Draw draw;
+
+ /**
+ * Text display at the top of the GUI for showing information to the user.
+ */
+ private BitmapText topText;
+
+ /**
+ * Executor service for handling asynchronous tasks within the application.
+ */
+ private ExecutorService executor;
+
+ /**
+ * Handler for managing the client's game logic.
+ */
+ private final ClientGameLogic logic;
+
+ /**
+ * Configuration settings for the Battleship client application.
+ */
+ private final MonopolyAppConfig config;
+
+ /**
+ * Listener for handling actions triggered by the Escape key.
+ */
+ private final ActionListener escapeListener = (name, isPressed, tpf) -> escape(isPressed);
+
+ //TODO temp for testing
+ private EventCard eventCard;
+ private BuildingPropertyCard buildingProperty;
+ private FoodFieldCard foodField;
+ private GateFieldCard gateField;
+ private BuyCard buyCard;
+ private boolean isBuyCardPopupOpen = false;
+ private final ActionListener BListener = (name, isPressed, tpf) -> handleB(isPressed);
+ private final ActionListener TListener = (name, isPressed, tpf) -> handleT(isPressed);
+ private TestWorld testWorld;
+
+ static {
+ // Configure logging
+ LogManager manager = LogManager.getLogManager();
+ try {
+ manager.readConfiguration(new FileInputStream("logging.properties"));
+ LOGGER.log(Level.INFO, "Successfully read logging properties"); //NON-NLS
+ }
+ catch (IOException e) {
+ LOGGER.log(Level.INFO, e.getMessage());
+ }
+ }
+
+ /**
+ * Starts the Battleship application.
+ *
+ * @param args Command-line arguments for launching the application.
+ */
public static void main(String[] args) {
new MonopolyApp().start();
}
- public MonopolyApp() {
- this.draw = new Draw(assetManager);
+ /**
+ * Constructs a new {@code MonopolyApp} instance.
+ * Initializes the configuration, server connection, and game logic listeners.
+ */
+ private MonopolyApp() {
config = new MonopolyAppConfig();
- serverConnection = new NetworkSupport(this);
+ config.readFromIfExists(CONFIG_FILE);
+ serverConnection = makeServerConnection();
logic = new ClientGameLogic(serverConnection);
logic.addListener(this);
setShowSettings(config.getShowSettings());
setSettings(makeSettings());
}
- @Override
- public MonopolyAppConfig getConfig() {
- return config;
+ /**
+ * Creates and configures application settings from the client configuration.
+ *
+ * @return A configured {@link AppSettings} object.
+ */
+ private AppSettings makeSettings() {
+ final AppSettings settings = new AppSettings(true);
+ settings.setTitle(lookup("monopoly.name"));
+ settings.setResolution(config.getResolutionWidth(), config.getResolutionHeight());
+ settings.setFullscreen(config.fullScreen());
+ settings.setUseRetinaFrameBuffer(config.useRetinaFrameBuffer());
+ settings.setGammaCorrection(config.useGammaCorrection());
+ return settings;
}
+ /**
+ * Factory method for creating a server connection based on the current
+ * client configuration.
+ *
+ * @return A {@link ServerConnection} instance, which could be a real or mock server.
+ */
+ private ServerConnection makeServerConnection() {
+ return new NetworkSupport(this);
+ }
+
+ /**
+ * Returns the dialog manager responsible for managing in-game dialogs.
+ *
+ * @return The {@link DialogManager} instance.
+ */
+ public DialogManager getDialogManager() {
+ return dialogManager;
+ }
+
+ /**
+ * Returns the game logic handler for the client.
+ *
+ * @return The {@link ClientGameLogic} instance.
+ */
@Override
public ClientGameLogic getGameLogic() {
return logic;
}
- private AppSettings makeSettings() {
- final AppSettings settings = new AppSettings(true);
- settings.setTitle("Monopoly Game");
- settings.setResolution(config.getResolutionWidth(), config.getResolutionHeight());
- settings.setFullscreen(config.fullScreen());
- return settings;
+ /**
+ * Returns the current configuration settings for the Battleship client.
+ *
+ * @return The {@link BattleshipClientConfig} instance.
+ */
+ @Override
+ public MonopolyAppConfig getConfig() {
+ return config;
}
+ /**
+ * Initializes the application.
+ * Sets up input mappings, GUI, game states, and connects to the server.
+ */
@Override
public void simpleInitApp() {
- GuiGlobals.initialize(this);
- BaseStyles.loadStyleResources(STYLES_SCRIPT);
- GuiGlobals.getInstance().getStyles().setDefaultStyle("pp"); //NON-NLS
- final BitmapFont normalFont = assetManager.loadFont(FONT); //NON-NLS
-
+ setPauseOnLostFocus(false);
+ draw = new Draw(assetManager);
setupInput();
+ setupStates();
setupGui();
-
- // Zeige das Startmenü
- StartMenu.createStartMenu(this);
+ new StartMenu(this).open();
}
+ /**
+ * Sets up the graphical user interface (GUI) for the application.
+ */
private void setupGui() {
- BitmapFont normalFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
+ GuiGlobals.initialize(this);
+ BaseStyles.loadStyleResources(STYLES_SCRIPT);
+ BaseStyles.loadGlassStyle();
+ GuiGlobals.getInstance().getStyles().setDefaultStyle("pp"); //NON-NLS
+ final BitmapFont normalFont = assetManager.loadFont(FONT); //NON-NLS
topText = new BitmapText(normalFont);
- topText.setLocalTranslation(10, settings.getHeight() - 10, 0);
+ final int height = context.getSettings().getHeight();
+ topText.setLocalTranslation(10f, height - 10f, 0f);
+ topText.setColor(config.getTopColor());
guiNode.attachChild(topText);
}
+ /**
+ * Configures input mappings and sets up listeners for user interactions.
+ */
private void setupInput() {
inputManager.deleteMapping(INPUT_MAPPING_EXIT);
- inputManager.setCursorVisible(true);
- inputManager.addMapping("ESC", new KeyTrigger(KeyInput.KEY_ESCAPE));
- inputManager.addListener(escapeListener, "ESC");
+ inputManager.setCursorVisible(false);
+ inputManager.addMapping(ESC, new KeyTrigger(KeyInput.KEY_ESCAPE));
+ inputManager.addMapping(CLICK, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
+ inputManager.addListener(escapeListener, ESC);
+
+ //TODO tmp for testing
+ inputManager.addMapping("B", new KeyTrigger(KeyInput.KEY_B));
+ inputManager.addListener(BListener, "B");
+ inputManager.addMapping("T", new KeyTrigger(KeyInput.KEY_T));
+ inputManager.addListener(TListener, "T");
}
- private void handleEscape(boolean isPressed) {
+ //logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen
+ private void handleB(boolean isPressed) {
if (isPressed) {
- if (settingsMenu != null && isSettingsMenuOpen) {
+ Dialog tmp = new BuyCard(this);
+ if (eventCard != null && isBuyCardPopupOpen) {
// Schließe das SettingsMenu
- System.out.println("Schließe SettingsMenu...");
- settingsMenu.close();
- settingsMenu = null;
- setSettingsMenuOpen(false);
+ System.out.println("Schließe BuyCardPopup...");
+ eventCard.close();
+ eventCard = null;
+ tmp.open();
} else {
// Öffne das SettingsMenu
- System.out.println("Öffne SettingsMenu...");
- settingsMenu = new SettingsMenu(this);
- settingsMenu.open();
- setSettingsMenuOpen(true);
+ System.out.println("Öffne BuyCardPopup...");
+ eventCard = new EventCard(this);
+ eventCard.open();
+ dialogManager.close(tmp);
}
}
}
-
-
- private void blockInputs() {
- if (!inputBlocked) {
- System.out.println("Blockiere Eingaben...");
- inputManager.setCursorVisible(true); // Cursor sichtbar machen
- inputManager.clearMappings(); // Alle Mappings entfernen
- inputBlocked = true;
- }
- }
-
- public void unblockInputs() {
- if (inputBlocked) {
- System.out.println("Aktiviere Eingaben...");
- setupInput(); // Standard-Eingaben neu registrieren
- inputBlocked = false;
+ //logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen
+ private void handleT(boolean isPressed) {
+ if (isPressed) {
+ testWorld = new TestWorld(this);
+ testWorld.initializeScene();
}
}
- public void setInfoText(String text) {
- topText.setText(text);
+
+
+ /**
+ * Initializes and attaches the necessary application states for the game.
+ */
+ private void setupStates() {
+ if (config.getShowStatistics()) {
+ final BitmapFont normalFont = assetManager.loadFont(FONT); //NON-NLS
+ final StatsAppState stats = new StatsAppState(guiNode, normalFont);
+ stateManager.attach(stats);
+ }
+ flyCam.setEnabled(false);
+ stateManager.detach(stateManager.getState(StatsAppState.class));
+ stateManager.detach(stateManager.getState(DebugKeysAppState.class));
+
+ attachGameSound();
+ attachGameMusic();
}
+ /**
+ * Attaches the game sound state and sets its initial enabled state.
+ */
+ private void attachGameSound() {
+ final GameSound gameSound = new GameSound();
+ logic.addListener(gameSound);
+ gameSound.setEnabled(GameSound.enabledInPreferences());
+ stateManager.attach(gameSound);
+ }
+
+ /**
+ * Attaches the background music state and sets its initial enabled state.
+ */
+ private void attachGameMusic() {
+ final GameMusic gameSound = new GameMusic();
+ gameSound.setEnabled(GameMusic.enabledInPreferences());
+ stateManager.attach(gameSound);
+ }
+
+ /**
+ * Updates the application state every frame.
+ * This method is called once per frame during the game loop.
+ *
+ * @param tpf Time per frame in seconds.
+ */
@Override
- public void receivedEvent(InfoTextEvent event) {
- setInfoText(event.key());
+ public void simpleUpdate(float tpf) {
+ super.simpleUpdate(tpf);
+ dialogManager.update(tpf);
+ logic.update(tpf);
+
+ //TODO testing replace later
+ if (testWorld != null) {
+ testWorld.update(tpf);
+ }
}
- @Override
- public void stop(boolean waitFor) {
- if (executor != null) executor.shutdownNow();
- serverConnection.disconnect();
- super.stop(waitFor);
- }
-
- public DialogManager getDialogManager() {
- return dialogManager;
+ /**
+ * Handles the Escape key action to either close the top dialog or show the main menu.
+ *
+ * @param isPressed Indicates whether the Escape key is pressed.
+ */
+ public void escape(boolean isPressed) {
+ if (!isPressed) return;
+ if (dialogManager.showsDialog())
+ dialogManager.escape();
+ else
+ new SettingsMenu(this).open();
}
+ /**
+ * Returns the {@link Draw} instance used for rendering graphical elements in the game.
+ *
+ * @return The {@link Draw} instance.
+ */
public Draw getDraw() {
return draw;
}
- public ExecutorService getExecutor() {
- return executor;
+ /**
+ * Tries to connect
+ */
+ public void connect() {
+ serverConnection.connect();
}
+ /**
+ * Handles a request to close the application.
+ * If the request is initiated by pressing ESC, this parameter is true.
+ *
+ * @param esc If true, the request is due to the ESC key being pressed.
+ */
+ @Override
+ public void requestClose(boolean esc) { /* do nothing */ }
+
+ /**
+ * Closes the application, displaying a confirmation dialog if the client is connected to a server.
+ */
public void closeApp() {
+ if (serverConnection.isConnected())
+ confirmDialog(lookup("confirm.leaving"), this::close);
+ else
+ close();
+ }
+
+ /**
+ * Closes the application, disconnecting from the server and stopping the application.
+ */
+ private void close() {
+ serverConnection.disconnect();
stop();
}
+ /**
+ * Updates the informational text displayed in the GUI.
+ *
+ * @param text The information text to display.
+ */
+ public void setInfoText(String text) {
+ LOGGER.log(Level.DEBUG, "setInfoText {0}", text); //NON-NLS
+ topText.setText(text);
+ }
+
+ /**
+ * Updates the informational text in the GUI based on the key received in an {@link InfoTextEvent}.
+ *
+ * @param event The {@link InfoTextEvent} containing the key for the text to display.
+ */
+ @Override
+ public void receivedEvent(InfoTextEvent event) {
+ LOGGER.log(Level.DEBUG, "received info text {0}", event.key()); //NON-NLS
+ setInfoText(lookup(event.key()));
+ }
+
+ /**
+ * Handles client state events to update the game states accordingly.
+ *
+ * @param event The {@link ClientStateEvent} representing the state change.
+ */
+ @Override
+ public void receivedEvent(ClientStateEvent event) {
+ }
+
+ /**
+ * Returns the executor service used for handling multithreaded tasks.
+ *
+ * @return The {@link ExecutorService} instance.
+ */
+ public ExecutorService getExecutor() {
+ if (executor == null)
+ executor = Executors.newCachedThreadPool();
+ return executor;
+ }
+
+ /**
+ * Stops the application, shutting down the executor service and halting execution.
+ *
+ * @param waitFor If true, waits for the application to stop before returning.
+ */
+ @Override
+ public void stop(boolean waitFor) {
+ if (executor != null) executor.shutdownNow();
+ super.stop(waitFor);
+ }
+
+ /**
+ * Displays a confirmation dialog with a specified question and action for the "Yes" button.
+ *
+ * @param question The question to display in the dialog.
+ * @param yesAction The action to perform if "Yes" is selected.
+ */
+ public void confirmDialog(String question, Runnable yesAction) {
+ DialogBuilder.simple(dialogManager)
+ .setTitle(lookup("dialog.question"))
+ .setText(question)
+ .setOkButton(lookup("button.yes"), d -> {
+ getGameLogic().playSound(Sound.BUTTON); // Play sound
+ yesAction.run(); // Execute the original yesAction
+ })
+ .setNoButton(lookup("button.no"), d -> getGameLogic().playSound(Sound.BUTTON))
+ .build()
+ .open();
+ }
+
+ /**
+ * Displays an error dialog with the specified error message.
+ *
+ * @param errorMessage The error message to display in the dialog.
+ */
public void errorDialog(String errorMessage) {
DialogBuilder.simple(dialogManager)
- .setTitle("Fehler")
- .setText(errorMessage)
- .setOkButton("OK")
- .build()
- .open();
+ .setTitle(lookup("dialog.error"))
+ .setText(errorMessage)
+ .setOkButton(lookup("button.ok"), d -> getGameLogic().playSound(Sound.BUTTON))
+ .build()
+ .open();
}
- public void setSettingsMenuOpen(boolean isOpen) {
- this.isSettingsMenuOpen = isOpen;
- }
-
- @Override
- public void simpleUpdate(float tpf) {
- if (testWorld != null) {
- testWorld.update(tpf); // Aktualisiere die Kamera in der TestWorld
- }
- }
-
- public void startTestWorld() {
- guiNode.detachAllChildren(); // Entferne GUI
- testWorld = new TestWorld(this); // Erstelle eine Instanz von TestWorld
- testWorld.initializeScene(); // Initialisiere die Szene
- }
-
- public void returnToMenu() {
- guiNode.detachAllChildren(); // Entferne die GUI
- StartMenu.createStartMenu(this); // Zeige das Startmenü erneut
+ public void disconnect() {
+ serverConnection.disconnect();
}
}
diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkDialog.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkDialog.java
deleted file mode 100644
index d399636..0000000
--- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkDialog.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package pp.monopoly.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.Container;
-import com.simsilica.lemur.Label;
-import com.simsilica.lemur.TextField;
-
-import pp.dialog.Dialog;
-import pp.dialog.DialogBuilder;
-import pp.dialog.SimpleDialog;
-
-/**
- * Represents a dialog for setting up a network connection in the Monopoly game.
- * Allows users to specify the host and port for connecting to a game server.
- */
-class NetworkDialog extends SimpleDialog {
- private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName());
- private static final String LOCALHOST = "localhost";
- private static final String DEFAULT_PORT = "1234";
- private final NetworkSupport network;
- private final TextField host = new TextField(LOCALHOST);
- private final TextField port = new TextField(DEFAULT_PORT);
- private String hostname;
- private int portNumber;
- private Future