This commit is contained in:
Johannes Schmelz 2024-12-02 03:00:28 +01:00
commit 2dbc727728
3 changed files with 26 additions and 30 deletions

View File

@ -25,7 +25,7 @@ import java.lang.System.Logger.Level;
import static pp.monopoly.Resources.lookup; import static pp.monopoly.Resources.lookup;
/** /**
* Manages the network connection for the Battleship application. * Manages the network connection for the Monopoly application.
* Handles connecting to and disconnecting from the server, and sending messages. * Handles connecting to and disconnecting from the server, and sending messages.
*/ */
public class NetworkSupport implements MessageListener<Client>, ClientStateListener, ServerConnection { public class NetworkSupport implements MessageListener<Client>, ClientStateListener, ServerConnection {
@ -34,9 +34,9 @@ public class NetworkSupport implements MessageListener<Client>, ClientStateListe
private Client client; private Client client;
/** /**
* Constructs a NetworkSupport instance for the given Battleship application. * Constructs a NetworkSupport instance for the given Monopoly application.
* *
* @param app The Battleship application instance. * @param app The Monopoly application instance.
*/ */
public NetworkSupport(MonopolyApp app) { public NetworkSupport(MonopolyApp app) {
this.app = app; this.app = app;
@ -44,6 +44,7 @@ public class NetworkSupport implements MessageListener<Client>, ClientStateListe
/** /**
* Return the client connections Id * Return the client connections Id
*
* @return the client id * @return the client id
*/ */
public int getId() { public int getId() {
@ -52,9 +53,9 @@ public class NetworkSupport implements MessageListener<Client>, ClientStateListe
} }
/** /**
* Returns the Battleship application instance. * Returns the Monopoly application instance.
* *
* @return Battleship application instance * @return Monopoly application instance
*/ */
public MonopolyApp getApp() { public MonopolyApp getApp() {
return app; return app;

View File

@ -84,24 +84,6 @@ public class TradeMenu extends Dialog {
mainContent.addChild(createMiddleSection()); mainContent.addChild(createMiddleSection());
mainContent.addChild(createTradeColumn("Wähle Zielobjekt:", false)); mainContent.addChild(createTradeColumn("Wähle Zielobjekt:", false));
Container buttons = mainContent.addChild(new Container(new SpringGridLayout()));
Button cancel = new Button("Abbrechen");
cancel.addClickCommands(s -> ifTopDialog(() -> {
close();
app.getGameLogic().playSound(Sound.BUTTON);
}));
Button trade = new Button("Handeln");
trade.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON);
setTrades();
app.getGameLogic().send(new TradeOffer(tradeHandler));
close();
}));
buttons.addChild(cancel);
buttons.addChild(trade);
return mainContent; return mainContent;
} }
@ -196,16 +178,30 @@ public class TradeMenu extends Dialog {
leftSelectionsField = middleSection.addChild(new TextField("")); leftSelectionsField = middleSection.addChild(new TextField(""));
leftSelectionsField.setPreferredSize(new Vector3f(600, 50, 0)); leftSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
Label arrows = middleSection.addChild(new Label("")); Container buttons = middleSection.addChild(new Container(new SpringGridLayout()));
arrows.setFontSize(40); Button cancel = new Button("Abbrechen");
cancel.addClickCommands(s -> ifTopDialog(() -> {
close();
app.getGameLogic().playSound(Sound.BUTTON);
}));
rightSelectionsField = middleSection.addChild(new TextField("")); Button trade = new Button("Handeln");
rightSelectionsField.setPreferredSize(new Vector3f(600, 50, 0)); trade.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON);
setTrades();
app.getGameLogic().send(new TradeOffer(tradeHandler));
close();
}));
buttons.addChild(cancel);
buttons.addChild(trade);
Label middleLabelBottom = middleSection.addChild(new Label("Gebäude: Währung: Sonderkarten:")); Label middleLabelBottom = middleSection.addChild(new Label("Gebäude: Währung: Sonderkarten:"));
middleLabelBottom.setFontSize(24); middleLabelBottom.setFontSize(24);
middleLabelBottom.setInsets(new Insets3f(5, 5, 5, 5)); middleLabelBottom.setInsets(new Insets3f(5, 5, 5, 5));
rightSelectionsField = middleSection.addChild(new TextField(""));
rightSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
return middleSection; return middleSection;
} }
@ -217,6 +213,7 @@ public class TradeMenu extends Dialog {
private void styleTextField(TextField textField) { private void styleTextField(TextField textField) {
textField.setInsets(new Insets3f(5, 10, 5, 10)); textField.setInsets(new Insets3f(5, 10, 5, 10));
textField.setBackground(new QuadBackgroundComponent(ColorRGBA.Black)); textField.setBackground(new QuadBackgroundComponent(ColorRGBA.Black));
textField.setPreferredSize(new Vector3f(300, 30, 0));
} }
private void assignSelectors(Selector<String> buildingSelector, Selector<String> specialCardSelector, TextField currencyInput, boolean isLeft) { private void assignSelectors(Selector<String> buildingSelector, Selector<String> specialCardSelector, TextField currencyInput, boolean isLeft) {
@ -281,7 +278,6 @@ public class TradeMenu extends Dialog {
} }
for (String property : leftselBuildings) { for (String property : leftselBuildings) {
buildingText.append(property); buildingText.append(property);
buildingText.append(", ");
} }
} else { } else {
if (rightselBuildings.contains(building.getSelectedItem())) { if (rightselBuildings.contains(building.getSelectedItem())) {
@ -291,7 +287,6 @@ public class TradeMenu extends Dialog {
} }
for (String property : rightselBuildings) { for (String property : rightselBuildings) {
buildingText.append(property); buildingText.append(property);
buildingText.append(", ");
} }
} }

View File

@ -53,7 +53,7 @@ public class WinnerPopUp extends Dialog {
backgroundContainer.setPreferredSize(WinnerContainer.getPreferredSize().addLocal(padding, padding, 0)); backgroundContainer.setPreferredSize(WinnerContainer.getPreferredSize().addLocal(padding, padding, 0));
// Titel // Titel
Label winnerTitle = WinnerContainer.addChild(new Label("Herlichen Glückwunsch, du bist der neue Monopoly Champion!", new ElementId("header"))); Label winnerTitle = WinnerContainer.addChild(new Label("Herzlichen Glückwunsch, du bist der neue Monopoly Champion!", new ElementId("header")));
winnerTitle.setFontSize(25); winnerTitle.setFontSize(25);
// winnerTitle.setColor(ColorRGBA.Black); // winnerTitle.setColor(ColorRGBA.Black);
// Create the image container // Create the image container