mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-08-06 15:40:28 +02:00
sellHouse
This commit is contained in:
@@ -147,6 +147,11 @@ public class BuyHouse extends Dialog {
|
||||
selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0));
|
||||
dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container
|
||||
|
||||
// Set initial selection
|
||||
if (!propertyOptions.isEmpty()) {
|
||||
onDropdownSelectionChanged(propertySelector);
|
||||
}
|
||||
|
||||
return dropdownContainer;
|
||||
}
|
||||
/**
|
||||
|
@@ -21,7 +21,7 @@ import pp.dialog.Dialog;
|
||||
import pp.monopoly.client.MonopolyApp;
|
||||
import pp.monopoly.client.gui.SettingsMenu;
|
||||
import pp.monopoly.game.server.Player;
|
||||
import pp.monopoly.message.client.BuyPropertyResponse;
|
||||
import pp.monopoly.message.client.AlterProperty;
|
||||
import pp.monopoly.model.fields.BoardManager;
|
||||
import pp.monopoly.model.fields.BuildingProperty;
|
||||
import pp.monopoly.notification.Sound;
|
||||
@@ -73,7 +73,7 @@ public class SellHouse extends Dialog {
|
||||
Container downContainer = sellhouseContainer.addChild(new Container());
|
||||
|
||||
// Text, der auf der Karte steht
|
||||
upContainer.addChild(new Label("„Grundstück wählen:", new ElementId("label-Text"))); //TODO hier überall die entsprechenden Variablen einfügen
|
||||
upContainer.addChild(new Label("„Grundstück wählen:", new ElementId("label-Text")));
|
||||
upContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
|
||||
upContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||
|
||||
@@ -99,9 +99,16 @@ public class SellHouse extends Dialog {
|
||||
confirmButton.setFontSize(32);
|
||||
confirmButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
// Send the "alter building" message to the server
|
||||
//app.getGameLogic().sendMessage(new AlterBuildingMessage(selected.getId(), false)); TODO Message an Server
|
||||
|
||||
AlterProperty msg = new AlterProperty("SellHouse");
|
||||
for (String string : selectedProperties) {
|
||||
System.out.println(string);
|
||||
}
|
||||
msg.setProperties(selectedProperties.stream().map(p -> app.getGameLogic().getBoardManager().getFieldByName(p).getId()).map(p -> (Integer) p).collect(Collectors.toSet()));
|
||||
for (Integer integer : msg.getProperties()) {
|
||||
System.out.println("ID des verkaufs: "+integer);
|
||||
}
|
||||
app.getGameLogic().send(msg);
|
||||
close();
|
||||
}));
|
||||
|
||||
// Zentriere das Popup
|
||||
@@ -149,6 +156,11 @@ public class SellHouse extends Dialog {
|
||||
selectionDisplay = new TextField(""); // Create TextField for displaying selections
|
||||
selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0));
|
||||
dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container
|
||||
|
||||
// Set initial selection
|
||||
if (!propertyOptions.isEmpty()) {
|
||||
onDropdownSelectionChanged(propertySelector);
|
||||
}
|
||||
|
||||
return dropdownContainer;
|
||||
}
|
||||
@@ -164,6 +176,7 @@ public class SellHouse extends Dialog {
|
||||
return boardManager.getPropertyFields(self.getProperties()).stream()
|
||||
.filter(property -> property instanceof BuildingProperty)
|
||||
.map(property -> (BuildingProperty) property)
|
||||
.filter(p -> app.getGameLogic().getBoardManager().canSell(p))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user