This commit is contained in:
Johannes Schmelz 2024-12-08 18:38:15 +01:00
commit e14f6bbef7
3 changed files with 19 additions and 16 deletions

View File

@ -13,6 +13,8 @@ import com.simsilica.lemur.HAlignment
import com.simsilica.lemur.Insets3f import com.simsilica.lemur.Insets3f
import com.simsilica.lemur.component.QuadBackgroundComponent import com.simsilica.lemur.component.QuadBackgroundComponent
import com.simsilica.lemur.component.TbtQuadBackgroundComponent import com.simsilica.lemur.component.TbtQuadBackgroundComponent
import pp.monopoly.client.MonopolyApp
import pp.monopoly.game.server.Player
def bgColor = color(1, 1, 1, 1) def bgColor = color(1, 1, 1, 1)
def buttonEnabledColor = color(0, 0, 0, 1) def buttonEnabledColor = color(0, 0, 0, 1)
@ -343,22 +345,23 @@ selector("selector.item.label", "hover") {
background = new QuadBackgroundComponent(new ColorRGBA(0.2f, 0.6f, 1.0f, 0.9f)) // Highlighted background background = new QuadBackgroundComponent(new ColorRGBA(0.2f, 0.6f, 1.0f, 0.9f)) // Highlighted background
} }
def enabledCommandToolbar = new Command<Button>() { def enabledCommandToolbar = new Command<Button>() {
MonopolyApp app // Pass the app instance to access player details
void execute(Button source) { void execute(Button source) {
// Get the current player's color
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
ColorRGBA playerColor = Player.getColor(currentPlayer.getId()).getColor();
if (source.isEnabled()) { if (source.isEnabled()) {
source.setColor(ColorRGBA.White) source.setColor(ColorRGBA.White);
def orangeBackground = new QuadBackgroundComponent(color(1, 1, 0, 1)); // Orange background def playerBackground = new QuadBackgroundComponent(playerColor); // Use player's color
source.setBackground(orangeBackground); source.setBackground(playerBackground);
} else { } else {
source.setColor(ColorRGBA.White) source.setColor(ColorRGBA.White);
def grayBackground = new QuadBackgroundComponent(ColorRGBA.Gray); // Gray background def grayBackground = new QuadBackgroundComponent(ColorRGBA.Gray); // Use gray when disabled
source.setBackground(grayBackground); source.setBackground(grayBackground);
} }
} }
} }

View File

@ -125,13 +125,13 @@ public class BuyHouse extends Dialog {
buyHouseContainer.setLocalTranslation( buyHouseContainer.setLocalTranslation(
(app.getCamera().getWidth() - buyHouseContainer.getPreferredSize().x) / 2, (app.getCamera().getWidth() - buyHouseContainer.getPreferredSize().x) / 2,
(app.getCamera().getHeight() + buyHouseContainer.getPreferredSize().y) / 2, (app.getCamera().getHeight() + buyHouseContainer.getPreferredSize().y) / 2,
9 11
); );
backgroundContainer.setLocalTranslation( backgroundContainer.setLocalTranslation(
(app.getCamera().getWidth() - buyHouseContainer.getPreferredSize().x - padding) / 2, (app.getCamera().getWidth() - buyHouseContainer.getPreferredSize().x - padding) / 2,
(app.getCamera().getHeight() + buyHouseContainer.getPreferredSize().y + padding) / 2, (app.getCamera().getHeight() + buyHouseContainer.getPreferredSize().y + padding) / 2,
8 10
); );
app.getGuiNode().attachChild(buyHouseContainer); app.getGuiNode().attachChild(buyHouseContainer);

View File

@ -83,14 +83,14 @@ public class EventCardPopup extends Dialog {
eventCardContainer.setLocalTranslation( eventCardContainer.setLocalTranslation(
(app.getCamera().getWidth() - eventCardContainer.getPreferredSize().x) / 2, (app.getCamera().getWidth() - eventCardContainer.getPreferredSize().x) / 2,
(app.getCamera().getHeight() + eventCardContainer.getPreferredSize().y) / 2, (app.getCamera().getHeight() + eventCardContainer.getPreferredSize().y) / 2,
10 9
); );
// Zentriere das Popup // Zentriere das Popup
backgroundContainer.setLocalTranslation( backgroundContainer.setLocalTranslation(
(app.getCamera().getWidth() - eventCardContainer.getPreferredSize().x - padding) / 2, (app.getCamera().getWidth() - eventCardContainer.getPreferredSize().x - padding) / 2,
(app.getCamera().getHeight() + eventCardContainer.getPreferredSize().y+ padding) / 2, (app.getCamera().getHeight() + eventCardContainer.getPreferredSize().y+ padding) / 2,
9 8
); );
app.getGuiNode().attachChild(eventCardContainer); app.getGuiNode().attachChild(eventCardContainer);