This commit is contained in:
Johannes Schmelz 2024-11-25 02:43:58 +01:00
parent acc797f2ff
commit ed105f1b70
6 changed files with 13 additions and 26 deletions

View File

@ -27,7 +27,6 @@ import static pp.monopoly.Resources.lookup;
import pp.monopoly.client.MonopolyApp; import pp.monopoly.client.MonopolyApp;
import pp.monopoly.client.NetworkSupport; import pp.monopoly.client.NetworkSupport;
import pp.monopoly.notification.Sound;
import pp.monopoly.server.MonopolyServer; import pp.monopoly.server.MonopolyServer;
import pp.dialog.Dialog; import pp.dialog.Dialog;
import pp.dialog.DialogBuilder; import pp.dialog.DialogBuilder;
@ -65,7 +64,7 @@ public class CreateGameMenu extends Dialog {
final MonopolyApp app = network.getApp(); final MonopolyApp app = network.getApp();
int screenWidth = app.getContext().getSettings().getWidth(); int screenWidth = app.getContext().getSettings().getWidth();
int screenHeight = app.getContext().getSettings().getHeight(); int screenHeight = app.getContext().getSettings().getHeight();
// Set up the background image // Set up the background image
@ -78,7 +77,6 @@ public class CreateGameMenu extends Dialog {
background.setLocalTranslation(0, 0, -1); // Ensure it is behind other GUI elements background.setLocalTranslation(0, 0, -1); // Ensure it is behind other GUI elements
app.getGuiNode().attachChild(background); app.getGuiNode().attachChild(background);
final Container input = new Container(new SpringGridLayout()); final Container input = new Container(new SpringGridLayout());
input.addChild(new Label(lookup("host.name") + ": ")); input.addChild(new Label(lookup("host.name") + ": "));
input.addChild(host, 1); input.addChild(host, 1);
@ -88,27 +86,20 @@ public class CreateGameMenu extends Dialog {
addChild(input); addChild(input);
// "Abbrechen"-Button // "Abbrechen"-Button
cancelButton.setPreferredSize(new Vector3f(120, 40, 0)); cancelButton.setPreferredSize(new Vector3f(120, 40, 0));
cancelButton.addClickCommands(source -> close());
addChild(cancelButton);
cancelButton.addClickCommands(s -> ifTopDialog(() -> { cancelButton.addClickCommands(s -> ifTopDialog(() -> {
this.close(); this.close();
new StartMenu(app); new StartMenu(network.getApp()).open();
app.getGameLogic().playSound(Sound.BUTTON);
})); }));
addChild(cancelButton);
// "Selber hosten"-Button // "Selber hosten"-Button
addChild(serverButton).addClickCommands(s -> ifTopDialog(() -> { serverButton.addClickCommands(s -> ifTopDialog(this::startServerInThread));
startServerInThread(); addChild(serverButton);
app.getGameLogic().playSound(Sound.BUTTON);
}));
// "Beitreten"-Button // "Beitreten"-Button
joinButton.setPreferredSize(new Vector3f(120, 40, 0)); joinButton.setPreferredSize(new Vector3f(120, 40, 0));
joinButton.addClickCommands(s -> ifTopDialog(this::connect));
addChild(joinButton); addChild(joinButton);
joinButton.addClickCommands(s -> ifTopDialog(() -> {
connect();
app.getGameLogic().playSound(Sound.BUTTON);
}));
} }
/** /**
@ -155,7 +146,7 @@ public class CreateGameMenu extends Dialog {
@Override @Override
public void escape() { public void escape() {
close(); new SettingsMenu(network.getApp()).open();
} }
/** /**
@ -218,7 +209,6 @@ public class CreateGameMenu extends Dialog {
try { try {
Thread.sleep(2000); Thread.sleep(2000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
connect(); connect();

View File

@ -131,11 +131,11 @@ public class LobbyMenu extends Dialog {
buttonContainer.setBackground(null); buttonContainer.setBackground(null);
// Lower-left container for "Abbrechen" button // Lower-left container for "Abbrechen" button
lowerLeftMenu = new Container(); lowerLeftMenu = new Container();
Button cancelButton = new Button("Abbrechen"); Button cancelButton = new Button("Beenden");
cancelButton.setPreferredSize(new Vector3f(200, 60, 0)); // Set size to match the appearance in the image cancelButton.setPreferredSize(new Vector3f(200, 60, 0)); // Set size to match the appearance in the image
cancelButton.setFontSize(18); // Adjust font size cancelButton.setFontSize(18); // Adjust font size
cancelButton.addClickCommands(s -> ifTopDialog(() -> { cancelButton.addClickCommands(s -> ifTopDialog(() -> {
this.close(); app.closeApp();
app.getGameLogic().playSound(Sound.BUTTON); app.getGameLogic().playSound(Sound.BUTTON);
})); }));
lowerLeftMenu.addChild(cancelButton); lowerLeftMenu.addChild(cancelButton);
@ -217,7 +217,7 @@ public class LobbyMenu extends Dialog {
@Override @Override
public void escape() { public void escape() {
super.close(); new SettingsMenu(app).open();
} }
/** /**

View File

@ -1,7 +1,6 @@
package pp.monopoly.client.gui; package pp.monopoly.client.gui;
import com.simsilica.lemur.Slider; import com.simsilica.lemur.Slider;
import pp.monopoly.client.GameMusic;
import pp.monopoly.client.GameSound; import pp.monopoly.client.GameSound;
public class SoundSlider extends Slider { public class SoundSlider extends Slider {

View File

@ -22,8 +22,6 @@ import pp.monopoly.client.gui.GameMenu;
*/ */
public class StartMenu extends Dialog { public class StartMenu extends Dialog {
private final MonopolyApp app; private final MonopolyApp app;
private Container logoContainer;
private Container unibwLogoContainer;
/** /**
* Constructs the Startup Menu dialog for the Monopoly application. * Constructs the Startup Menu dialog for the Monopoly application.

View File

@ -3,10 +3,11 @@ package pp.monopoly.client.gui.popups;
import com.jme3.material.Material; import com.jme3.material.Material;
import com.jme3.material.RenderState.BlendMode; import com.jme3.material.RenderState.BlendMode;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry; import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Quad; import com.jme3.scene.shape.Quad;
import com.simsilica.lemur.*; import com.simsilica.lemur.Button;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.component.QuadBackgroundComponent; import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.style.ElementId; import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog; import pp.dialog.Dialog;

View File

@ -5,7 +5,6 @@ import com.jme3.material.RenderState.BlendMode;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry; import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Quad; import com.jme3.scene.shape.Quad;
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.component.QuadBackgroundComponent; import com.simsilica.lemur.component.QuadBackgroundComponent;