This commit is contained in:
Johannes Schmelz 2024-11-29 07:11:24 +01:00
commit fcbffa1189
4 changed files with 35 additions and 2 deletions

View File

@ -262,6 +262,16 @@ selector("settings-title", "pp") {
textHAlignment = HAlignment.Center
textVAlignment = VAlignment.Center
}
selector("warning-title", "pp") {
def outerBackground = new QuadBackgroundComponent(color(1, 0.5, 0, 1)) // Grey inner border
def innerBackground = new QuadBackgroundComponent(buttonBgColor) // White outer border background
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-42.fnt")
background = outerBackground
fontSize = 40
insets = new Insets3f(3, 3, 3, 3)
textHAlignment = HAlignment.Center
textVAlignment = VAlignment.Center
}
selector("menu-button", "pp") {
fontSize = 40 // Set font size

View File

@ -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
}
}
}

View File

@ -49,7 +49,7 @@ public class Bankrupt extends Dialog {
backgroundContainer.setPreferredSize(bankruptContainer.getPreferredSize().addLocal(padding, padding, 0));
// Titel
Label gateFieldTitle = bankruptContainer.addChild(new Label("Vorsicht !", new ElementId("settings-title"))); //TODO Dicke Schrift
Label gateFieldTitle = bankruptContainer.addChild(new Label("Vorsicht !", new ElementId("warning-title")));
gateFieldTitle.setFontSize(48);
gateFieldTitle.setColor(ColorRGBA.Black);

View File

@ -52,7 +52,7 @@ public class TimeOut extends Dialog {
backgroundContainer.setPreferredSize(timeOutContainer.getPreferredSize().addLocal(padding, padding, 0));
// Titel
Label gateFieldTitle = timeOutContainer.addChild(new Label("Vorsicht !", new ElementId("settings-title"))); //TODO dicke Schrift
Label gateFieldTitle = timeOutContainer.addChild(new Label("Vorsicht !", new ElementId("warning-title")));
gateFieldTitle.setFontSize(48);
gateFieldTitle.setColor(ColorRGBA.Black);