mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 00:06:16 +01:00
simplified representation of trade
This commit is contained in:
parent
49b9972ade
commit
9ee1b5b81b
@ -218,8 +218,10 @@ public class TradeMenu extends Dialog {
|
||||
Container middleSection = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
||||
middleSection.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8f, 0.8f, 0.8f, 1.0f)));
|
||||
|
||||
Label middleLabelTop = middleSection.addChild(new Label("Gebäude: Währung: Sonderkarten:"));
|
||||
Label middleLabelTop = middleSection.addChild(new Label("Meine Gebäude:"));
|
||||
middleLabelTop.setFontSize(24);
|
||||
middleLabelTop.setTextVAlignment(VAlignment.Center);
|
||||
middleLabelTop.setTextHAlignment(HAlignment.Center);
|
||||
middleLabelTop.setInsets(new Insets3f(5, 5, 5, 5));
|
||||
|
||||
leftSelectionsLabel = middleSection.addChild(new Label(""));
|
||||
@ -243,8 +245,10 @@ public class TradeMenu extends Dialog {
|
||||
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 des Gegenspielers:"));
|
||||
middleLabelBottom.setFontSize(24);
|
||||
middleLabelBottom.setTextVAlignment(VAlignment.Center);
|
||||
middleLabelBottom.setTextHAlignment(HAlignment.Center);
|
||||
middleLabelBottom.setInsets(new Insets3f(5, 5, 5, 5));
|
||||
|
||||
rightSelectionsLabel = middleSection.addChild(new Label(""));
|
||||
@ -322,25 +326,23 @@ public class TradeMenu extends Dialog {
|
||||
*/
|
||||
@Override
|
||||
public void update(float delta) {
|
||||
if (leftBuildingRef.update() || leftCardRef.update() || leftCurrencyRef.update()) {
|
||||
updateSelections(leftSelectionsLabel, leftBuildingSelector, leftCurrencyInput, leftSpecialCardSelector, true);
|
||||
if (leftBuildingRef.update() || leftCardRef.update()) {
|
||||
updateSelections(leftSelectionsLabel, leftBuildingSelector, true);
|
||||
}
|
||||
|
||||
if (rightBuildingRef.update() || rightCardRef.update() || rightCurrencyRef.update()) {
|
||||
updateSelections(rightSelectionsLabel, rightBuildingSelector, rightCurrencyInput, rightSpecialCardSelector, false);
|
||||
if (rightBuildingRef.update() || rightCardRef.update()) {
|
||||
updateSelections(rightSelectionsLabel, rightBuildingSelector, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the displayed selections for properties, currency, and cards.
|
||||
* Updates the displayed selections for properties.
|
||||
*
|
||||
* @param target the target text field to update
|
||||
* @param target the target label to update
|
||||
* @param building the building selector
|
||||
* @param currency the currency input field
|
||||
* @param card the special card selector
|
||||
* @param isLeft true if updating the left column; false otherwise
|
||||
*/
|
||||
private void updateSelections(Label target, Selector<String> building, TextField currency, Selector<String> card, boolean isLeft) {
|
||||
private void updateSelections(Label target, Selector<String> building, boolean isLeft) {
|
||||
StringBuilder buildingText = new StringBuilder();
|
||||
if (isLeft) {
|
||||
if (leftselBuildings.contains(building.getSelectedItem())) {
|
||||
@ -362,9 +364,7 @@ public class TradeMenu extends Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
String currencyText = currency.getText() != null ? currency.getText().trim() : "";
|
||||
String cardText = card.getSelectedItem() != null ? card.getSelectedItem() : "";
|
||||
target.setText(String.join(" | ", buildingText.toString().replaceAll(", $", ""), currencyText, cardText));
|
||||
target.setText(buildingText.toString().replaceAll(", $", ""));
|
||||
}
|
||||
|
||||
/** Opens the settings menu when the escape key is pressed. */
|
||||
|
Loading…
Reference in New Issue
Block a user