mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-18 22:56:15 +01:00
added color changes for buttons
This commit is contained in:
parent
640665fd29
commit
b901323e2f
@ -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) {
|
||||||
if (source.isEnabled()){
|
// Get the current player's color
|
||||||
source.setColor(ColorRGBA.White)
|
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
|
||||||
def orangeBackground = new QuadBackgroundComponent(color(1, 1, 0, 1)); // Orange background
|
ColorRGBA playerColor = Player.getColor(currentPlayer.getId()).getColor();
|
||||||
source.setBackground(orangeBackground);
|
|
||||||
} else{
|
if (source.isEnabled()) {
|
||||||
source.setColor(ColorRGBA.White)
|
source.setColor(ColorRGBA.White);
|
||||||
def grayBackground = new QuadBackgroundComponent(ColorRGBA.Gray); // Gray background
|
def playerBackground = new QuadBackgroundComponent(playerColor); // Use player's color
|
||||||
|
source.setBackground(playerBackground);
|
||||||
|
} else {
|
||||||
|
source.setColor(ColorRGBA.White);
|
||||||
|
def grayBackground = new QuadBackgroundComponent(ColorRGBA.Gray); // Use gray when disabled
|
||||||
source.setBackground(grayBackground);
|
source.setBackground(grayBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user