Compare commits

..

No commits in common. "fa20a6cb2ae534aa94dda219fdcae457ceccdcd1" and "411f7ea25b59d152ee9a6d50ef30f3d2793f3618" have entirely different histories.

6 changed files with 36 additions and 31 deletions

View File

@ -163,6 +163,14 @@ public class BuildingAdminMenu extends Dialog {
app.getGuiNode().attachChild(background);
}
/**
* Handles the "Zurück" action.
*/
private void handleBack() {
app.getGameLogic().playSound(Sound.BUTTON);
close();
}
@Override
public void close() {
app.getGuiNode().detachChild(mainContainer);
@ -172,7 +180,7 @@ public class BuildingAdminMenu extends Dialog {
@Override
public void escape() {
new SettingsMenu(app).open();
handleBack();
}
@Override

View File

@ -84,6 +84,24 @@ public class TradeMenu extends Dialog {
mainContent.addChild(createMiddleSection());
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;
}
@ -178,30 +196,16 @@ public class TradeMenu extends Dialog {
leftSelectionsField = middleSection.addChild(new TextField(""));
leftSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
Container buttons = middleSection.addChild(new Container(new SpringGridLayout()));
Button cancel = new Button("Abbrechen");
cancel.addClickCommands(s -> ifTopDialog(() -> {
close();
app.getGameLogic().playSound(Sound.BUTTON);
}));
Label arrows = middleSection.addChild(new Label(""));
arrows.setFontSize(40);
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);
rightSelectionsField = middleSection.addChild(new TextField(""));
rightSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
Label middleLabelBottom = middleSection.addChild(new Label("Gebäude: Währung: Sonderkarten:"));
middleLabelBottom.setFontSize(24);
middleLabelBottom.setInsets(new Insets3f(5, 5, 5, 5));
rightSelectionsField = middleSection.addChild(new TextField(""));
rightSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
return middleSection;
}
@ -213,7 +217,6 @@ public class TradeMenu extends Dialog {
private void styleTextField(TextField textField) {
textField.setInsets(new Insets3f(5, 10, 5, 10));
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) {
@ -278,6 +281,7 @@ public class TradeMenu extends Dialog {
}
for (String property : leftselBuildings) {
buildingText.append(property);
buildingText.append(", ");
}
} else {
if (rightselBuildings.contains(building.getSelectedItem())) {
@ -287,6 +291,7 @@ public class TradeMenu extends Dialog {
}
for (String property : rightselBuildings) {
buildingText.append(property);
buildingText.append(", ");
}
}

View File

@ -99,7 +99,6 @@ public class BuyHouse extends Dialog {
AlterProperty msg = new AlterProperty("BuyHouse");
msg.setProperties(selectedProperties.stream().map(p -> app.getGameLogic().getBoardManager().getFieldByName(p).getId()).map(p -> (Integer) p).collect(Collectors.toSet()));
app.getGameLogic().send(msg);
close();
}));
// Center the popup
@ -161,7 +160,6 @@ public class BuyHouse extends Dialog {
return boardManager.getPropertyFields(self.getProperties()).stream()
.filter(property -> property instanceof BuildingProperty)
.map(property -> (BuildingProperty) property)
.filter(property -> app.getGameLogic().getBoardManager().canBuild(property))
.collect(Collectors.toList());
}

View File

@ -357,7 +357,6 @@ public class ServerGameLogic implements ClientInterpreter {
private void updateAllPlayers() {
for (Player player : playerHandler.getPlayers()) {
send(player, new PlayerStatusUpdate(playerHandler));
send(player, new ViewAssetsResponse(boardManager));
}
}
@ -419,14 +418,7 @@ public class ServerGameLogic implements ClientInterpreter {
playerHandler.getPlayerById(from).useJailCard();
} else if (msg.getA().equals("PayJail")) {
playerHandler.getPlayerById(from).payBail();
} else if(msg.getA().equals("hack")) {
System.out.println("HAck ausgeführt");
for (BuildingProperty bp : boardManager.getPropertyFields( List.of(1,3)).stream().filter(p -> p instanceof BuildingProperty).map(p -> (BuildingProperty) p).collect(Collectors.toList())) {
bp.setOwner(playerHandler.getPlayerById(0));
playerHandler.getPlayerById(0).addProperty(bp.getId());
}
}
updateAllPlayers();
}
}

View File

@ -131,7 +131,7 @@ public class BoardManager {
.collect(Collectors.toList());
// Check if the player owns all properties in the color group
if (!groupProperties.stream().allMatch(bp -> bp.getOwner() != null && bp.getOwner().getId() == field.getOwner().getId())) {
if (!groupProperties.stream().allMatch(bp -> bp.getOwner() != null && bp.getOwner().equals(field.getOwner()))) {
return false; // The player must own all properties in the color group
}

View File

@ -1,10 +1,12 @@
package pp.monopoly.model.fields;
import com.jme3.math.ColorRGBA;
import com.jme3.network.serializing.Serializable;
/**
* Enum representing eight distinct colors for properties in the game.
*/
// @Serializable
public enum FieldColor {
BROWN(new ColorRGBA(148 / 255f, 86 / 255f, 57 / 255f, 1)),
GREEN(new ColorRGBA(30 / 255f, 179 / 255f, 90 / 255f, 1)),