mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 02:36:14 +01:00
added colored strip to toolbar
This commit is contained in:
parent
4b5a156865
commit
ecf227daa6
@ -67,8 +67,8 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
Container playerColorBar = new Container();
|
Container playerColorBar = new Container();
|
||||||
playerColorBar.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 40, 0)); // Höhe des Balkens auf 10 festlegen
|
playerColorBar.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 40, 0)); // Höhe des Balkens auf 10 festlegen
|
||||||
playerColorBar.setBackground(new QuadBackgroundComponent(playerColor));
|
playerColorBar.setBackground(new QuadBackgroundComponent(playerColor));
|
||||||
playerColorBar.setLocalTranslation(0, 200, 1); // Positioniere ihn an der oberen Kante der Toolbar
|
playerColorBar.setLocalTranslation(0, 220, 1); // Positioniere ihn an der oberen Kante der Toolbar
|
||||||
container.attachChild(playerColorBar);
|
app.getGuiNode().attachChild(playerColorBar);
|
||||||
|
|
||||||
// Übersicht und Konto
|
// Übersicht und Konto
|
||||||
accountContainer = container.addChild(new Container());
|
accountContainer = container.addChild(new Container());
|
||||||
@ -220,7 +220,6 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
app.enqueue(() -> {
|
app.enqueue(() -> {
|
||||||
setDiceIcon(imageLabel, diceToString(event.a()));
|
setDiceIcon(imageLabel, diceToString(event.a()));
|
||||||
setDiceIcon(imageLabel2, diceToString(event.b()));
|
setDiceIcon(imageLabel2, diceToString(event.b()));
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import com.simsilica.lemur.*;
|
|||||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
import com.simsilica.lemur.component.SpringGridLayout;
|
import com.simsilica.lemur.component.SpringGridLayout;
|
||||||
import com.simsilica.lemur.core.VersionedList;
|
import com.simsilica.lemur.core.VersionedList;
|
||||||
|
import com.simsilica.lemur.core.VersionedReference;
|
||||||
import com.simsilica.lemur.style.ElementId;
|
import com.simsilica.lemur.style.ElementId;
|
||||||
import pp.dialog.Dialog;
|
import pp.dialog.Dialog;
|
||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
@ -21,6 +22,8 @@ import pp.monopoly.model.TradeHandler;
|
|||||||
import pp.monopoly.model.fields.PropertyField;
|
import pp.monopoly.model.fields.PropertyField;
|
||||||
import pp.monopoly.notification.Sound;
|
import pp.monopoly.notification.Sound;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class TradeMenu extends Dialog {
|
public class TradeMenu extends Dialog {
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
private final TradeHandler tradeHandler;
|
private final TradeHandler tradeHandler;
|
||||||
@ -30,6 +33,11 @@ public class TradeMenu extends Dialog {
|
|||||||
private Selector<String> rightBuildingSelector, rightSpecialCardSelector;
|
private Selector<String> rightBuildingSelector, rightSpecialCardSelector;
|
||||||
private TextField leftSelectionsField, rightSelectionsField;
|
private TextField leftSelectionsField, rightSelectionsField;
|
||||||
private TextField leftCurrencyInput, rightCurrencyInput;
|
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);
|
private static final ColorRGBA TRANSLUCENT_WHITE = new ColorRGBA(1, 1, 1, 0.5f);
|
||||||
|
|
||||||
@ -257,12 +265,30 @@ public class TradeMenu extends Dialog {
|
|||||||
super.close();
|
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.
|
* Handles dropdown selection changes and updates the trade handler.
|
||||||
*
|
*
|
||||||
* @param selected The selected item from the dropdown.
|
* @param selected The selected item from the dropdown.
|
||||||
*/
|
*/
|
||||||
private void onDropdownSelectionChanged(String selected) {
|
/* private void onDropdownSelectionChanged(String selected) {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
int idStart = selected.indexOf("(ID: ") + 5; // Find start of the ID
|
int idStart = selected.indexOf("(ID: ") + 5; // Find start of the ID
|
||||||
int idEnd = selected.indexOf(")", idStart); // Find end 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);
|
Player selectedPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(playerId);
|
||||||
|
|
||||||
if (selectedPlayer != null) {
|
if (selectedPlayer != null) {
|
||||||
tradeHandler.setReceiver(selectedPlayer); // Set the receiver in TradeHandler
|
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user