mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 00:06:16 +01:00
added selector with no integration
This commit is contained in:
parent
908ba09e2a
commit
67f6649242
@ -16,6 +16,7 @@ import com.simsilica.lemur.core.VersionedList;
|
||||
import com.simsilica.lemur.style.ElementId;
|
||||
import pp.dialog.Dialog;
|
||||
import pp.monopoly.client.MonopolyApp;
|
||||
import pp.monopoly.game.server.Player;
|
||||
import pp.monopoly.model.TradeHandler;
|
||||
import pp.monopoly.model.fields.PropertyField;
|
||||
import pp.monopoly.notification.Sound;
|
||||
@ -99,6 +100,7 @@ public class TradeMenu extends Dialog {
|
||||
|
||||
column.addChild(new Label("Gebäude:"));
|
||||
Selector<String> buildingSelector = createPropertySelector(isLeft);
|
||||
buildingSelector.getPopupContainer().setBackground(new QuadBackgroundComponent(ColorRGBA.Orange));
|
||||
column.addChild(buildingSelector);
|
||||
|
||||
column.addChild(new Label("Währung:"));
|
||||
@ -107,6 +109,7 @@ public class TradeMenu extends Dialog {
|
||||
|
||||
column.addChild(new Label("Sonderkarten:"));
|
||||
Selector<String> specialCardSelector = createSpecialCardSelector();
|
||||
specialCardSelector.getPopupContainer().setBackground(new QuadBackgroundComponent(ColorRGBA.Orange));
|
||||
styleSelector(specialCardSelector);
|
||||
column.addChild(specialCardSelector);
|
||||
|
||||
@ -253,4 +256,24 @@ public class TradeMenu extends Dialog {
|
||||
app.getGuiNode().detachChild(mainContainer);
|
||||
super.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles dropdown selection changes and updates the trade handler.
|
||||
*
|
||||
* @param selected The selected item from the dropdown.
|
||||
*/
|
||||
private void onDropdownSelectionChanged(String selected) {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
int idStart = selected.indexOf("(ID: ") + 5; // Find start of the ID
|
||||
int idEnd = selected.indexOf(")", idStart); // Find end of the ID
|
||||
String idStr = selected.substring(idStart, idEnd); // Extract the ID as a string
|
||||
int playerId = Integer.parseInt(idStr); // Convert the ID to an integer
|
||||
|
||||
// Find the player by ID
|
||||
Player selectedPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(playerId);
|
||||
|
||||
if (selectedPlayer != null) {
|
||||
tradeHandler.setReceiver(selectedPlayer); // Set the receiver in TradeHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user