mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-28 23:39:45 +01:00
fixed button disabled behaviour
This commit is contained in:
parent
bcd6711965
commit
5e0ac0abc7
@ -297,3 +297,37 @@ selector("selector.item.label", "hover") {
|
||||
background = new QuadBackgroundComponent(new ColorRGBA(0.2f, 0.6f, 1.0f, 0.9f)) // Highlighted background
|
||||
}
|
||||
|
||||
|
||||
def enabledCommandToolbar = new Command<Button>() {
|
||||
void execute(Button source) {
|
||||
if (source.isEnabled())
|
||||
source.setColor(ColorRGBA.White)
|
||||
else
|
||||
source.setColor(ColorRGBA.Gray)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
def stdButtonCommandsToolbar = [
|
||||
(ButtonAction.Down) : [pressedCommand],
|
||||
(ButtonAction.Up) : [pressedCommand],
|
||||
(ButtonAction.Enabled) : [enabledCommandToolbar],
|
||||
(ButtonAction.Disabled): [enabledCommandToolbar]
|
||||
]
|
||||
|
||||
selector("button-toolbar", "pp") {
|
||||
def outerBackground = new QuadBackgroundComponent(color(1, 0.5, 0, 1)) // Orange border
|
||||
def innerBackground = new QuadBackgroundComponent(buttonBgColor) // Inner button background
|
||||
|
||||
// Apply the outer border as the main background
|
||||
background = outerBackground
|
||||
|
||||
// Use insets to create a margin/padding effect for the inner background
|
||||
insets = new Insets3f(3, 3, 3, 3) // Adjust the border thickness
|
||||
textHAlignment = HAlignment.Center
|
||||
textVAlignment = VAlignment.Center
|
||||
buttonCommands = stdButtonCommandsToolbar
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class Toolbar extends Dialog implements GameEventListener {
|
||||
diceContainer.addChild(horizontalContainer);
|
||||
|
||||
// Würfeln-Button
|
||||
Button diceButton = new Button("Würfeln");
|
||||
Button diceButton = new Button("Würfeln", new ElementId("button-toolbar"));
|
||||
diceButton.setPreferredSize(new Vector3f(200, 50, 0));
|
||||
diceButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
startDiceAnimation();
|
||||
@ -103,7 +103,7 @@ public class Toolbar extends Dialog implements GameEventListener {
|
||||
}
|
||||
|
||||
private Button addTradeMenuButton() {
|
||||
Button tradeButton = new Button("Handeln");
|
||||
Button tradeButton = new Button("Handeln", new ElementId("button-toolbar"));
|
||||
tradeButton.setPreferredSize(new Vector3f(150, 50, 0));
|
||||
tradeButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
@ -113,7 +113,7 @@ public class Toolbar extends Dialog implements GameEventListener {
|
||||
}
|
||||
|
||||
private Button addPropertyMenuButton() {
|
||||
Button propertyMenuButton = new Button("Grundstücke");
|
||||
Button propertyMenuButton = new Button("Grundstücke", new ElementId("button-toolbar"));
|
||||
propertyMenuButton.setPreferredSize(new Vector3f(150, 50, 0));
|
||||
propertyMenuButton.setFontSize(30);
|
||||
propertyMenuButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
@ -125,7 +125,7 @@ public class Toolbar extends Dialog implements GameEventListener {
|
||||
}
|
||||
|
||||
private Button addEndTurnButton() {
|
||||
Button endTurnButton = new Button("Zug beenden");
|
||||
Button endTurnButton = new Button("Zug beenden", new ElementId("button-toolbar"));
|
||||
endTurnButton.setPreferredSize(new Vector3f(150, 50, 0));
|
||||
endTurnButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
|
Loading…
Reference in New Issue
Block a user