lobby menu

This commit is contained in:
Johannes Schmelz 2024-11-24 21:01:57 +01:00
parent 8b0ef97a82
commit d7df4002da
3 changed files with 14 additions and 18 deletions

View File

@ -146,7 +146,7 @@ public class CreateGameMenu extends SimpleDialog {
connectionFuture = null;
progressDialog.close();
this.close();
network.getApp().setInfoText(lookup("wait.for.an.opponent"));
new LobbyMenu(network.getApp()).open();
}
/**

View File

@ -22,11 +22,14 @@ import com.simsilica.lemur.component.SpringGridLayout;
import com.simsilica.lemur.core.VersionedList;
import com.simsilica.lemur.core.VersionedReference;
import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.message.client.PlayerReady;
import java.util.Set;
public class LobbyMenu {
public class LobbyMenu extends Dialog {
private final MonopolyApp app;
private final Container menuContainer;
@ -36,6 +39,7 @@ public class LobbyMenu {
private Container lowerRightMenu;
public LobbyMenu(MonopolyApp app) {
super(app.getDialogManager());
this.app = app;
// Entfernt das CreateGameMenu (inklusive Hintergrund)
@ -129,7 +133,7 @@ public class LobbyMenu {
Button cancelButton = new Button("Abbrechen");
cancelButton.setPreferredSize(new Vector3f(200, 60, 0)); // Set size to match the appearance in the image
cancelButton.setFontSize(18); // Adjust font size
cancelButton.addClickCommands(source -> goBackToCreateGame()); // Add functionality
cancelButton.addClickCommands(source -> close()); // Add functionality
lowerLeftMenu.addChild(cancelButton);
// Position the container near the bottom-left corner
@ -201,20 +205,12 @@ public class LobbyMenu {
* Schaltet den "Bereit"-Status um.
*/
private void toggleReady(Label playersLabel) {
// Beispiel-Logik für das Umschalten des Status
playersLabel.setText("Spielerstatus aktualisiert."); // Beispieltext
app.getGameLogic().send(new PlayerReady(true, "Test", "flugzeug", 15000));;
}
/**
* Geht zurück zum CreateGameMenu.
*/
private void goBackToCreateGame() {
app.getGuiNode().detachChild(menuContainer);
app.getGuiNode().detachChild(background);
app.getGuiNode().detachChild(circle);
app.getGuiNode().detachChild(lowerLeftMenu);
app.getGuiNode().detachChild(lowerRightMenu);
// app.getServerConnection().connect();
@Override
public void close() {
super.close();
}
/**
@ -269,7 +265,7 @@ public class LobbyMenu {
System.out.println("Gamma selected");
break;
case "[3]":
goBackToCreateGame();
close();
break;
default:
System.out.println("Unknown selection");

View File

@ -139,7 +139,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
*
* @param msg the message to be sent
*/
void send(ClientMessage msg) {
public void send(ClientMessage msg) {
if (clientSender == null) {
LOGGER.log(Level.ERROR, "trying to send {0} with sender==null", msg); //NON-NLS
} else {