mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-28 18:59:47 +01:00
lobby menu
This commit is contained in:
parent
8b0ef97a82
commit
d7df4002da
@ -146,7 +146,7 @@ public class CreateGameMenu extends SimpleDialog {
|
|||||||
connectionFuture = null;
|
connectionFuture = null;
|
||||||
progressDialog.close();
|
progressDialog.close();
|
||||||
this.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.VersionedList;
|
||||||
import com.simsilica.lemur.core.VersionedReference;
|
import com.simsilica.lemur.core.VersionedReference;
|
||||||
import com.simsilica.lemur.style.ElementId;
|
import com.simsilica.lemur.style.ElementId;
|
||||||
|
|
||||||
|
import pp.dialog.Dialog;
|
||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
|
import pp.monopoly.message.client.PlayerReady;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class LobbyMenu {
|
public class LobbyMenu extends Dialog {
|
||||||
|
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
private final Container menuContainer;
|
private final Container menuContainer;
|
||||||
@ -36,6 +39,7 @@ public class LobbyMenu {
|
|||||||
private Container lowerRightMenu;
|
private Container lowerRightMenu;
|
||||||
|
|
||||||
public LobbyMenu(MonopolyApp app) {
|
public LobbyMenu(MonopolyApp app) {
|
||||||
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
// Entfernt das CreateGameMenu (inklusive Hintergrund)
|
// Entfernt das CreateGameMenu (inklusive Hintergrund)
|
||||||
@ -64,7 +68,7 @@ public class LobbyMenu {
|
|||||||
spacerBeforeInput.setPreferredSize(new Vector3f(20, 1, 0)); // Width of the spacer
|
spacerBeforeInput.setPreferredSize(new Vector3f(20, 1, 0)); // Width of the spacer
|
||||||
|
|
||||||
// Add an input field (TextField)
|
// 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.setPreferredWidth(100); // Set the width of the input field
|
||||||
startingCapital.setPreferredSize(new Vector3f(150, 50, 0));
|
startingCapital.setPreferredSize(new Vector3f(150, 50, 0));
|
||||||
startingCapital.setInsets(new Insets3f(5, 10, 5, 10)); // Add padding around the text inside the field
|
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");
|
Button cancelButton = new Button("Abbrechen");
|
||||||
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(source -> goBackToCreateGame()); // Add functionality
|
cancelButton.addClickCommands(source -> close()); // Add functionality
|
||||||
lowerLeftMenu.addChild(cancelButton);
|
lowerLeftMenu.addChild(cancelButton);
|
||||||
|
|
||||||
// Position the container near the bottom-left corner
|
// Position the container near the bottom-left corner
|
||||||
@ -201,20 +205,12 @@ public class LobbyMenu {
|
|||||||
* Schaltet den "Bereit"-Status um.
|
* Schaltet den "Bereit"-Status um.
|
||||||
*/
|
*/
|
||||||
private void toggleReady(Label playersLabel) {
|
private void toggleReady(Label playersLabel) {
|
||||||
// Beispiel-Logik für das Umschalten des Status
|
app.getGameLogic().send(new PlayerReady(true, "Test", "flugzeug", 15000));;
|
||||||
playersLabel.setText("Spielerstatus aktualisiert."); // Beispieltext
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Geht zurück zum CreateGameMenu.
|
public void close() {
|
||||||
*/
|
super.close();
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -269,7 +265,7 @@ public class LobbyMenu {
|
|||||||
System.out.println("Gamma selected");
|
System.out.println("Gamma selected");
|
||||||
break;
|
break;
|
||||||
case "[3]":
|
case "[3]":
|
||||||
goBackToCreateGame();
|
close();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.out.println("Unknown selection");
|
System.out.println("Unknown selection");
|
||||||
|
@ -139,7 +139,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
|||||||
*
|
*
|
||||||
* @param msg the message to be sent
|
* @param msg the message to be sent
|
||||||
*/
|
*/
|
||||||
void send(ClientMessage msg) {
|
public void send(ClientMessage msg) {
|
||||||
if (clientSender == null) {
|
if (clientSender == null) {
|
||||||
LOGGER.log(Level.ERROR, "trying to send {0} with sender==null", msg); //NON-NLS
|
LOGGER.log(Level.ERROR, "trying to send {0} with sender==null", msg); //NON-NLS
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user