added colored strip to toolbar

This commit is contained in:
Yvonne Schmidt 2024-11-29 07:42:59 +01:00
parent 4b5a156865
commit ecf227daa6
2 changed files with 32 additions and 7 deletions

View File

@ -67,8 +67,8 @@ public class Toolbar extends Dialog implements GameEventListener {
Container playerColorBar = new Container();
playerColorBar.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 40, 0)); // Höhe des Balkens auf 10 festlegen
playerColorBar.setBackground(new QuadBackgroundComponent(playerColor));
playerColorBar.setLocalTranslation(0, 200, 1); // Positioniere ihn an der oberen Kante der Toolbar
container.attachChild(playerColorBar);
playerColorBar.setLocalTranslation(0, 220, 1); // Positioniere ihn an der oberen Kante der Toolbar
app.getGuiNode().attachChild(playerColorBar);
// Übersicht und Konto
accountContainer = container.addChild(new Container());
@ -220,7 +220,6 @@ public class Toolbar extends Dialog implements GameEventListener {
app.enqueue(() -> {
setDiceIcon(imageLabel, diceToString(event.a()));
setDiceIcon(imageLabel2, diceToString(event.b()));
app.getGameLogic().playSound(Sound.BUTTON);
});
}

View File

@ -13,6 +13,7 @@ import com.simsilica.lemur.*;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.component.SpringGridLayout;
import com.simsilica.lemur.core.VersionedList;
import com.simsilica.lemur.core.VersionedReference;
import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
@ -21,6 +22,8 @@ import pp.monopoly.model.TradeHandler;
import pp.monopoly.model.fields.PropertyField;
import pp.monopoly.notification.Sound;
import java.util.Set;
public class TradeMenu extends Dialog {
private final MonopolyApp app;
private final TradeHandler tradeHandler;
@ -30,6 +33,11 @@ public class TradeMenu extends Dialog {
private Selector<String> rightBuildingSelector, rightSpecialCardSelector;
private TextField leftSelectionsField, rightSelectionsField;
private TextField leftCurrencyInput, rightCurrencyInput;
private VersionedReference<Set<Integer>> selectionRef; // Reference to track selector changes
private String valueSelected = ""; // To keep track of the last selected value
private String buildingSelected = "";
private String specialCardSelected = "";
private static final ColorRGBA TRANSLUCENT_WHITE = new ColorRGBA(1, 1, 1, 0.5f);
@ -257,12 +265,30 @@ public class TradeMenu extends Dialog {
super.close();
}
/**
* Updates the dialog periodically, called by the dialog manager.
*
* @param delta The time elapsed since the last update.
*/
@Override
public void update(float delta) {
// Check if the selection has changed
// if (selectionRef.update()) {
// String selected = playerSelector.getSelectedItem();
// if (!selected.equals(lastSelected)) {
// lastSelected = selected;
// onDropdownSelectionChanged(selected);
}
}
/**
* Handles dropdown selection changes and updates the trade handler.
*
* @param selected The selected item from the dropdown.
*/
private void onDropdownSelectionChanged(String selected) {
/* 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
@ -273,7 +299,7 @@ public class TradeMenu extends Dialog {
Player selectedPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(playerId);
if (selectedPlayer != null) {
tradeHandler.setReceiver(selectedPlayer); // Set the receiver in TradeHandler
}
}
}
}*/