mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-28 17:49:44 +01:00
lobby menu
This commit is contained in:
parent
8b0ef97a82
commit
d7df4002da
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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)
|
||||
@ -64,7 +68,7 @@ public class LobbyMenu {
|
||||
spacerBeforeInput.setPreferredSize(new Vector3f(20, 1, 0)); // Width of the spacer
|
||||
|
||||
// Add an input field (TextField)
|
||||
TextField startingCapital = horizontalContainer.addChild(new TextField("15 000"));
|
||||
TextField startingCapital = horizontalContainer.addChild(new TextField("15000"));
|
||||
startingCapital.setPreferredWidth(100); // Set the width of the input field
|
||||
startingCapital.setPreferredSize(new Vector3f(150, 50, 0));
|
||||
startingCapital.setInsets(new Insets3f(5, 10, 5, 10)); // Add padding around the text inside the field
|
||||
@ -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");
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user