added server label

This commit is contained in:
Johannes Schmelz 2024-11-19 14:46:11 +01:00
parent 843052989b
commit 6157db51da
2 changed files with 11 additions and 1 deletions

View File

@ -228,4 +228,8 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
public MonopolyServer getMonopolyServer() { public MonopolyServer getMonopolyServer() {
return monopolyServer; return monopolyServer;
} }
public ServerConnection getServerConnection() {
return serverConnection;
}
} }

View File

@ -70,7 +70,7 @@ public class CreateGameMenu {
// "Selber hosten"-Button // "Selber hosten"-Button
Button hostButton = buttonContainer.addChild(new Button("Selber hosten")); Button hostButton = buttonContainer.addChild(new Button("Selber hosten"));
hostButton.setPreferredSize(new Vector3f(120, 40, 0)); hostButton.setPreferredSize(new Vector3f(120, 40, 0));
hostButton.addClickCommands(source -> app.startServer()); hostButton.addClickCommands(source -> startServer());
// "Beitreten"-Button (vorerst funktionslos) // "Beitreten"-Button (vorerst funktionslos)
Button joinButton = buttonContainer.addChild(new Button("Beitreten")); Button joinButton = buttonContainer.addChild(new Button("Beitreten"));
@ -123,4 +123,10 @@ public class CreateGameMenu {
app.getGuiNode().detachChild(background); // Entfernt das Hintergrundbild app.getGuiNode().detachChild(background); // Entfernt das Hintergrundbild
StartMenu.createStartMenu(app); StartMenu.createStartMenu(app);
} }
private void startServer() {
app.start();
app.getServerConnection().connect();
JOptionPane.showMessageDialog(null, "Server Started");
}
} }