mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-04-17 12:40:59 +02:00
Compare commits
No commits in common. "6b110c81c84ebb36807c4fb7c1300be49cf1ba57" and "645433610f093b81eb61f5fd603b8dcc1d025c9b" have entirely different histories.
6b110c81c8
...
645433610f
@ -348,7 +348,7 @@ def enabledCommandToolbar = new Command<Button>() {
|
|||||||
void execute(Button source) {
|
void execute(Button source) {
|
||||||
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 orangeBackground = new QuadBackgroundComponent(color(1, 0.5, 0, 1)); // Orange background
|
||||||
source.setBackground(orangeBackground);
|
source.setBackground(orangeBackground);
|
||||||
} else{
|
} else{
|
||||||
source.setColor(ColorRGBA.White)
|
source.setColor(ColorRGBA.White)
|
||||||
@ -384,20 +384,12 @@ selector("button-toolbar", "pp") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
selector("button-toolbar2", "pp") { playerColor ->
|
selector("button-toolbar2", "pp") {
|
||||||
def validColor = playerColor ?: new ColorRGBA(0, 0, 0, 0) // Vollständig transparent
|
insets = new Insets3f(3, 3, 3, 3) // Adjust the border thickness
|
||||||
def playerGradientBackground = new QuadBackgroundComponent(validColor)
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
// Kein Hintergrundbild, komplett transparent
|
buttonCommands = stdButtonCommandsToolbar
|
||||||
playerGradientBackground.setColor(new ColorRGBA(0, 0, 0, 0)) // RGBA (Rot, Grün, Blau, Alpha)
|
|
||||||
|
|
||||||
background = playerGradientBackground.clone() // Setze den Hintergrund
|
|
||||||
insets = new Insets3f(3, 3, 3, 3) // Optional: Ränder
|
|
||||||
textHAlignment = HAlignment.Center // Text-Zentrierung
|
|
||||||
textVAlignment = VAlignment.Center // Text-Zentrierung
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import com.jme3.material.Material;
|
|||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.FastMath;
|
import com.jme3.math.FastMath;
|
||||||
import com.jme3.math.Quaternion;
|
import com.jme3.math.Quaternion;
|
||||||
|
import com.jme3.math.Vector2f;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.renderer.Camera;
|
import com.jme3.renderer.Camera;
|
||||||
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
||||||
@ -21,10 +22,11 @@ import com.jme3.shadow.EdgeFilteringMode;
|
|||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import com.jme3.util.SkyFactory;
|
import com.jme3.util.SkyFactory;
|
||||||
import com.jme3.util.TangentBinormalGenerator;
|
import com.jme3.util.TangentBinormalGenerator;
|
||||||
|
import pp.monopoly.model.Board;
|
||||||
import pp.monopoly.client.gui.BobTheBuilder;
|
import pp.monopoly.client.gui.BobTheBuilder;
|
||||||
import pp.monopoly.client.gui.Toolbar;
|
import pp.monopoly.client.gui.Toolbar;
|
||||||
import pp.monopoly.model.Board;
|
|
||||||
|
import static pp.util.FloatMath.PI;
|
||||||
import static pp.util.FloatMath.TWO_PI;
|
import static pp.util.FloatMath.TWO_PI;
|
||||||
import static pp.util.FloatMath.cos;
|
import static pp.util.FloatMath.cos;
|
||||||
import static pp.util.FloatMath.sin;
|
import static pp.util.FloatMath.sin;
|
||||||
@ -179,12 +181,12 @@ public class BoardAppState extends MonopolyAppState {
|
|||||||
*/
|
*/
|
||||||
private void setupSky() {
|
private void setupSky() {
|
||||||
final AssetManager assetManager = getApp().getAssetManager();
|
final AssetManager assetManager = getApp().getAssetManager();
|
||||||
final Texture west = assetManager.loadTexture("Pictures/Backdrop/west.jpg"); //NON-NLS
|
final Texture west = assetManager.loadTexture("Pictures/Backdrop/backdrop.jpg"); //NON-NLS
|
||||||
final Texture east = assetManager.loadTexture("Pictures/Backdrop/ost.jpg"); //NON-NLS
|
final Texture east = assetManager.loadTexture("Pictures/Backdrop/backdrop.jpg"); //NON-NLS
|
||||||
final Texture north = assetManager.loadTexture("Pictures/Backdrop/nord.jpg"); //NON-NLS
|
final Texture north = assetManager.loadTexture("Pictures/Backdrop/backdrop.jpg"); //NON-NLS
|
||||||
final Texture south = assetManager.loadTexture("Pictures/Backdrop/sued.jpg"); //NON-NLS
|
final Texture south = assetManager.loadTexture("Pictures/Backdrop/backdrop.jpg"); //NON-NLS
|
||||||
final Texture up = assetManager.loadTexture("Pictures/Backdrop/sued.jpg"); //NON-NLS
|
final Texture up = assetManager.loadTexture("Pictures/Backdrop/backdrop.jpg"); //NON-NLS
|
||||||
final Texture down = assetManager.loadTexture("Pictures/Backdrop/sued.jpg"); //NON-NLS
|
final Texture down = assetManager.loadTexture("Pictures/Backdrop/backdrop.jpg"); //NON-NLS
|
||||||
final Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
|
final Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
|
||||||
// sky.rotate(0, PI, 0);
|
// sky.rotate(0, PI, 0);
|
||||||
viewNode.attachChild(sky);
|
viewNode.attachChild(sky);
|
||||||
|
@ -19,7 +19,6 @@ import pp.dialog.Dialog;
|
|||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
import pp.monopoly.client.gui.popups.Bankrupt;
|
import pp.monopoly.client.gui.popups.Bankrupt;
|
||||||
import pp.monopoly.game.server.Player;
|
import pp.monopoly.game.server.Player;
|
||||||
import pp.monopoly.game.server.PlayerColor;
|
|
||||||
import pp.monopoly.game.server.PlayerHandler;
|
import pp.monopoly.game.server.PlayerHandler;
|
||||||
import pp.monopoly.message.client.EndTurn;
|
import pp.monopoly.message.client.EndTurn;
|
||||||
import pp.monopoly.message.client.RollDice;
|
import pp.monopoly.message.client.RollDice;
|
||||||
@ -105,7 +104,6 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
/**Indicates if the bankrupt PopUp has already been shown */
|
/**Indicates if the bankrupt PopUp has already been shown */
|
||||||
private boolean bankruptPopUp = false;
|
private boolean bankruptPopUp = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the toolbar for the Monopoly application.
|
* Constructs the toolbar for the Monopoly application.
|
||||||
* <p>
|
* <p>
|
||||||
@ -124,21 +122,6 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
|
|
||||||
toolbarContainer = createToolbarContainer();
|
toolbarContainer = createToolbarContainer();
|
||||||
app.getGuiNode().attachChild(toolbarContainer);
|
app.getGuiNode().attachChild(toolbarContainer);
|
||||||
|
|
||||||
Button dice2Button = createDice2Button();
|
|
||||||
app.getGuiNode().attachChild(dice2Button);
|
|
||||||
|
|
||||||
// Neues Label mit Bild als Hintergrund
|
|
||||||
Label imageLabel = new Label("");
|
|
||||||
IconComponent imageIcon = new IconComponent("Pictures/CyanBackground.png");
|
|
||||||
imageIcon.setIconSize(new Vector2f(450, 200));
|
|
||||||
imageLabel.setIcon(imageIcon);
|
|
||||||
|
|
||||||
// Setze die Position des Labels
|
|
||||||
imageLabel.setLocalTranslation(20, 205, 0);
|
|
||||||
|
|
||||||
// Füge das Label zur GUI hinzu
|
|
||||||
app.getGuiNode().attachChild(imageLabel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Container createToolbarContainer() {
|
private Container createToolbarContainer() {
|
||||||
@ -149,45 +132,42 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
QuadBackgroundComponent background = new QuadBackgroundComponent(backgroundToolbar);
|
QuadBackgroundComponent background = new QuadBackgroundComponent(backgroundToolbar);
|
||||||
container.setBackground(background);
|
container.setBackground(background);
|
||||||
|
|
||||||
// Spielerfarbe des aktuellen Spielers abrufen
|
// Spielerfarbe abrufen
|
||||||
Player currentPlayer = playerHandler.getPlayerById(app.getId());
|
Player currentPlayer = playerHandler.getPlayerById(app.getId());
|
||||||
PlayerColor currentPlayerColor = Player.getColor(currentPlayer.getId());
|
ColorRGBA playerColor = Player.getColor(currentPlayer.getId()).getColor();
|
||||||
|
|
||||||
// Oberer Balken mit der Spielerfarbe
|
// Oberer Balken
|
||||||
Container playerColorBar = new Container();
|
Container playerColorBar = new Container();
|
||||||
playerColorBar.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 5, 0)); // Höhe des oberen Balkens
|
playerColorBar.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 15, 0)); // Höhe des oberen Balkens
|
||||||
playerColorBar.setBackground(new QuadBackgroundComponent(ColorRGBA.DarkGray));
|
playerColorBar.setBackground(new QuadBackgroundComponent(playerColor));
|
||||||
playerColorBar.setLocalTranslation(0, 205, 3); // Position über der Toolbar
|
playerColorBar.setLocalTranslation(0, 210, 3); // Position über der Toolbar
|
||||||
app.getGuiNode().attachChild(playerColorBar);
|
app.getGuiNode().attachChild(playerColorBar);
|
||||||
|
|
||||||
|
|
||||||
// unterer Balken
|
// unterer Balken
|
||||||
Container playerColorBarbot = new Container();
|
Container playerColorBarbot = new Container();
|
||||||
playerColorBarbot.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 10, 0)); // Höhe des oberen Balkens
|
playerColorBarbot.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 10, 0)); // Höhe des oberen Balkens
|
||||||
playerColorBarbot.setBackground(new QuadBackgroundComponent(ColorRGBA.DarkGray));
|
playerColorBarbot.setBackground(new QuadBackgroundComponent(playerColor));
|
||||||
playerColorBarbot.setLocalTranslation(0, 5, 3); // Position über der Toolbar
|
playerColorBarbot.setLocalTranslation(0, 10, 3); // Position über der Toolbar
|
||||||
app.getGuiNode().attachChild(playerColorBarbot);
|
app.getGuiNode().attachChild(playerColorBarbot);
|
||||||
|
|
||||||
|
|
||||||
// Linker Balken
|
// Linker Balken
|
||||||
Container leftBar = new Container();
|
Container leftBar = new Container();
|
||||||
leftBar.setPreferredSize(new Vector3f(5, 210, 0)); // Breite 10, Höhe 210
|
leftBar.setPreferredSize(new Vector3f(10, 210, 0)); // Breite 10, Höhe 210
|
||||||
leftBar.setBackground(new QuadBackgroundComponent(ColorRGBA.DarkGray));
|
leftBar.setBackground(new QuadBackgroundComponent(playerColor));
|
||||||
leftBar.setLocalTranslation(0, 200, 3); // Position am linken Rand
|
leftBar.setLocalTranslation(0, 200, 3); // Position am linken Rand
|
||||||
app.getGuiNode().attachChild(leftBar);
|
app.getGuiNode().attachChild(leftBar);
|
||||||
|
|
||||||
// Rechter Balken
|
// Rechter Balken
|
||||||
Container rightBar = new Container();
|
Container rightBar = new Container();
|
||||||
rightBar.setPreferredSize(new Vector3f(5, 210, 0)); // Breite 10, Höhe 210
|
rightBar.setPreferredSize(new Vector3f(10, 210, 0)); // Breite 10, Höhe 210
|
||||||
rightBar.setBackground(new QuadBackgroundComponent(ColorRGBA.DarkGray));
|
rightBar.setBackground(new QuadBackgroundComponent(playerColor));
|
||||||
rightBar.setLocalTranslation(app.getCamera().getWidth() - 5, 200, 2); // Position am rechten Rand
|
rightBar.setLocalTranslation(app.getCamera().getWidth() - 10, 200, 2); // Position am rechten Rand
|
||||||
app.getGuiNode().attachChild(rightBar);
|
app.getGuiNode().attachChild(rightBar);
|
||||||
|
|
||||||
// Übersicht und Konto
|
// Übersicht und Konto
|
||||||
accountContainer = container.addChild(new Container());
|
accountContainer = container.addChild(new Container());
|
||||||
overviewContainer = container.addChild(new Container());
|
overviewContainer = container.addChild(new Container());
|
||||||
accountContainer.setBackground(new QuadBackgroundComponent(ColorRGBA.Yellow)); // Debug-Farbe
|
|
||||||
overviewContainer.setBackground(new QuadBackgroundComponent(ColorRGBA.Green)); // Debug-Farbe;
|
|
||||||
receivedEvent(new UpdatePlayerView()); // Initiale Aktualisierung
|
receivedEvent(new UpdatePlayerView()); // Initiale Aktualisierung
|
||||||
|
|
||||||
// Würfel-Bereich
|
// Würfel-Bereich
|
||||||
@ -195,29 +175,22 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
|
|
||||||
// Aktionsmenü
|
// Aktionsmenü
|
||||||
Container menuContainer = container.addChild(new Container());
|
Container menuContainer = container.addChild(new Container());
|
||||||
menuContainer.addChild(createTradeButton(currentPlayerColor));
|
menuContainer.addChild(createTradeButton());
|
||||||
menuContainer.addChild(createPropertyMenuButton(currentPlayerColor));
|
menuContainer.addChild(createPropertyMenuButton());
|
||||||
menuContainer.addChild(createEndTurnButton(currentPlayerColor));
|
menuContainer.addChild(createEndTurnButton());
|
||||||
menuContainer.setBackground(null);
|
menuContainer.setBackground(null);
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Container createDiceSection() {
|
private Container createDiceSection() {
|
||||||
Container diceContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
Container diceContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||||
diceContainer.addChild(createDiceDisplay());
|
diceContainer.addChild(createDiceDisplay());
|
||||||
diceContainer.setBackground(null);
|
diceContainer.setBackground(null);
|
||||||
|
|
||||||
diceButton = new Button("", new ElementId("button-toolbar2"));
|
diceButton = new Button("Würfeln", new ElementId("button-toolbar"));
|
||||||
diceButton.setPreferredSize(new Vector3f(200, 50, 10));
|
diceButton.setPreferredSize(new Vector3f(200, 50, 0));
|
||||||
|
|
||||||
// Unsichtbaren Hintergrund setzen
|
|
||||||
QuadBackgroundComponent transparentBackground = new QuadBackgroundComponent(new ColorRGBA(0, 0, 0, 0.0f)); // Transparent
|
|
||||||
diceButton.setBackground(transparentBackground);
|
|
||||||
|
|
||||||
// Verschieben um 200 nach links
|
|
||||||
diceButton.setLocalTranslation(-200, 0, 0); // X: -200, Y: 0, Z: 0 (bleibt in derselben Höhe)
|
|
||||||
|
|
||||||
diceButton.addClickCommands(s -> ifTopDialog(() -> {
|
diceButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
diceButton.setEnabled(false);
|
diceButton.setEnabled(false);
|
||||||
endTurnButton.setEnabled(true);
|
endTurnButton.setEnabled(true);
|
||||||
@ -230,30 +203,6 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
return diceContainer;
|
return diceContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button createDice2Button() {
|
|
||||||
// Erstelle den Button
|
|
||||||
Button dice2Button = new Button("", new ElementId("button-toolbar2"));
|
|
||||||
dice2Button.setPreferredSize(new Vector3f(300, 200, 10)); // Setze die Größe
|
|
||||||
|
|
||||||
// Setze einen unsichtbaren Hintergrund
|
|
||||||
QuadBackgroundComponent transparentBackground = new QuadBackgroundComponent(new ColorRGBA(0, 0, 0, 0.2f)); // Halbdurchsichtig
|
|
||||||
dice2Button.setBackground(transparentBackground);
|
|
||||||
|
|
||||||
// Positioniere den Button unabhängig
|
|
||||||
dice2Button.setLocalTranslation(500, 200, 8); // Setze X, Y, Z für eine feste Position
|
|
||||||
|
|
||||||
// Füge Klickverhalten hinzu
|
|
||||||
dice2Button.addClickCommands(s -> ifTopDialog(() -> {
|
|
||||||
dice2Button.setEnabled(false); // Deaktiviere den Button nach Klick
|
|
||||||
endTurnButton.setEnabled(true); // Aktiviere den EndTurn-Button
|
|
||||||
startDiceAnimation(); // Starte die Animation
|
|
||||||
app.getGameLogic().send(new RollDice()); // Sende die Nachricht
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON); // Spiele den Sound
|
|
||||||
}));
|
|
||||||
|
|
||||||
return dice2Button;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Container createDiceDisplay() {
|
private Container createDiceDisplay() {
|
||||||
Container horizontalContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
Container horizontalContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||||
horizontalContainer.setPreferredSize(new Vector3f(200, 150, 0));
|
horizontalContainer.setPreferredSize(new Vector3f(200, 150, 0));
|
||||||
@ -284,27 +233,21 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button createTradeButton(PlayerColor playerColor) {
|
private Button createTradeButton() {
|
||||||
tradeButton = new Button("", new ElementId("button-toolbar2"));
|
|
||||||
tradeButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe setzen
|
|
||||||
|
|
||||||
// Setze den Hintergrund
|
tradeButton = new Button("", new ElementId("button-toolbar"));
|
||||||
QuadBackgroundComponent background = new QuadBackgroundComponent(playerColor.getColor());
|
tradeButton.setPreferredSize(new Vector3f(150, 50, 0));
|
||||||
Texture gradientTexture = app.getAssetManager().loadTexture("Textures/gradient.png");
|
|
||||||
if (gradientTexture != null) {
|
|
||||||
background.setTexture(gradientTexture);
|
|
||||||
}
|
|
||||||
tradeButton.setBackground(background);
|
|
||||||
|
|
||||||
// Icon hinzufügen
|
|
||||||
String iconTradePath = "icons/icon-handeln.png";
|
String iconTradePath = "icons/icon-handeln.png";
|
||||||
IconComponent iconTrade = new IconComponent(iconTradePath);
|
IconComponent iconTrade = new IconComponent(iconTradePath);
|
||||||
iconTrade.setHAlignment(HAlignment.Center);
|
iconTrade.setHAlignment(HAlignment.Center);
|
||||||
iconTrade.setVAlignment(VAlignment.Center);
|
iconTrade.setVAlignment(VAlignment.Center);
|
||||||
iconTrade.setIconSize(new Vector2f(100, 100));
|
iconTrade.setIconSize(new Vector2f(100, 100));
|
||||||
tradeButton.setIcon(iconTrade);
|
|
||||||
|
|
||||||
// Klickverhalten
|
tradeButton.setIcon(iconTrade);
|
||||||
|
tradeButton.setFontSize(40);
|
||||||
|
|
||||||
|
// Add click behavior
|
||||||
tradeButton.addClickCommands(source -> ifTopDialog(() -> {
|
tradeButton.addClickCommands(source -> ifTopDialog(() -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
new ChoosePartner(app).open();
|
new ChoosePartner(app).open();
|
||||||
@ -313,19 +256,10 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
return tradeButton;
|
return tradeButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button createPropertyMenuButton(PlayerColor playerColor) {
|
private Button createPropertyMenuButton() {
|
||||||
propertyMenuButton = new Button("", new ElementId("button-toolbar2"));
|
propertyMenuButton = new Button("", new ElementId("button-toolbar2"));
|
||||||
propertyMenuButton.setPreferredSize(new Vector3f(150, 50, 0));
|
propertyMenuButton.setPreferredSize(new Vector3f(150, 50, 0));
|
||||||
|
|
||||||
// Setze den Hintergrund
|
|
||||||
QuadBackgroundComponent background = new QuadBackgroundComponent(playerColor.getColor());
|
|
||||||
Texture gradientTexture = app.getAssetManager().loadTexture("Textures/gradient.png");
|
|
||||||
if (gradientTexture != null) {
|
|
||||||
background.setTexture(gradientTexture);
|
|
||||||
}
|
|
||||||
propertyMenuButton.setBackground(background);
|
|
||||||
|
|
||||||
// Icon hinzufügen
|
|
||||||
String iconBuildingPath = "icons/icon-gebaude.png";
|
String iconBuildingPath = "icons/icon-gebaude.png";
|
||||||
IconComponent iconBuilding = new IconComponent(iconBuildingPath);
|
IconComponent iconBuilding = new IconComponent(iconBuildingPath);
|
||||||
iconBuilding.setHAlignment(HAlignment.Center);
|
iconBuilding.setHAlignment(HAlignment.Center);
|
||||||
@ -333,61 +267,37 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
iconBuilding.setIconSize(new Vector2f(75, 75));
|
iconBuilding.setIconSize(new Vector2f(75, 75));
|
||||||
|
|
||||||
propertyMenuButton.setIcon(iconBuilding);
|
propertyMenuButton.setIcon(iconBuilding);
|
||||||
|
|
||||||
// Schriftgröße und Klick-Kommandos
|
|
||||||
propertyMenuButton.setFontSize(30);
|
propertyMenuButton.setFontSize(30);
|
||||||
propertyMenuButton.addClickCommands(s -> ifTopDialog(() -> {
|
propertyMenuButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
new BuildingAdminMenu(app).open();
|
new BuildingAdminMenu(app).open();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return propertyMenuButton;
|
return propertyMenuButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Button createEndTurnButton() {
|
||||||
|
endTurnButton = new Button("", new ElementId("button-toolbar"));
|
||||||
|
endTurnButton.setFontSize(28);
|
||||||
|
endTurnButton.setPreferredSize(new Vector3f(150, 50, 0));
|
||||||
|
|
||||||
private Button createEndTurnButton(PlayerColor playerColor) {
|
|
||||||
// Erstelle den Button
|
|
||||||
endTurnButton = new Button("", new ElementId("button-toolbar2"));
|
|
||||||
endTurnButton.setFontSize(28); // Setze die Schriftgröße
|
|
||||||
endTurnButton.setPreferredSize(new Vector3f(150, 50, 0)); // Setze die Größe
|
|
||||||
|
|
||||||
// Setze den Hintergrund
|
|
||||||
QuadBackgroundComponent background = new QuadBackgroundComponent(ColorRGBA.Gray); // Standardgrau
|
|
||||||
Texture gradientTexture = app.getAssetManager().loadTexture("Textures/gradient.png"); // Lade Gradient-Textur
|
|
||||||
if (gradientTexture != null) {
|
|
||||||
background.setTexture(gradientTexture); // Füge die Textur hinzu, wenn verfügbar
|
|
||||||
} else {
|
|
||||||
System.err.println("Gradient texture not found for EndTurn button!");
|
|
||||||
}
|
|
||||||
endTurnButton.setBackground(background);
|
|
||||||
|
|
||||||
// Füge das Icon hinzu
|
|
||||||
String iconEndTurnPath = "icons/icon-zugbeenden.png";
|
String iconEndTurnPath = "icons/icon-zugbeenden.png";
|
||||||
IconComponent iconEndTurn = new IconComponent(iconEndTurnPath);
|
IconComponent iconEndTurn = new IconComponent(iconEndTurnPath);
|
||||||
iconEndTurn.setHAlignment(HAlignment.Center);
|
iconEndTurn.setHAlignment(HAlignment.Center);
|
||||||
iconEndTurn.setVAlignment(VAlignment.Center);
|
iconEndTurn.setVAlignment(VAlignment.Center);
|
||||||
iconEndTurn.setIconSize(new Vector2f(75, 75)); // Größe des Icons
|
iconEndTurn.setIconSize(new Vector2f(75, 75));
|
||||||
|
|
||||||
endTurnButton.setIcon(iconEndTurn);
|
endTurnButton.setIcon(iconEndTurn);
|
||||||
|
endTurnButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
// Klickverhalten für den Button
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
endTurnButton.addClickCommands(source -> ifTopDialog(() -> {
|
if (app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getAccountBalance() < 0 && !bankruptPopUp) {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON); // Spiele den Klick-Sound ab
|
new Bankrupt(app).open();
|
||||||
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
|
|
||||||
|
|
||||||
// Überprüfe den Kontostand des Spielers
|
|
||||||
if (currentPlayer.getAccountBalance() < 0 && !bankruptPopUp) {
|
|
||||||
new Bankrupt(app).open(); // Öffne den Bankrott-Dialog
|
|
||||||
bankruptPopUp = true;
|
bankruptPopUp = true;
|
||||||
} else {
|
} else {
|
||||||
bankruptPopUp = false;
|
bankruptPopUp = false;
|
||||||
app.getGameLogic().send(new EndTurn()); // Sende EndTurn-Nachricht
|
app.getGameLogic().send(new EndTurn());
|
||||||
receivedEvent(new ButtonStatusEvent(false)); // Aktualisiere die Button-Statusanzeige
|
receivedEvent(new ButtonStatusEvent(false));
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Debug-Log hinzufügen
|
|
||||||
System.out.println("End Turn Button created successfully.");
|
|
||||||
|
|
||||||
return endTurnButton;
|
return endTurnButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,13 +399,6 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
playerHandler.getPlayerById(app.getId()).getNumJailCard() + "",
|
playerHandler.getPlayerById(app.getId()).getNumJailCard() + "",
|
||||||
new ElementId("label-account")
|
new ElementId("label-account")
|
||||||
));
|
));
|
||||||
|
|
||||||
// Setze accountContainer auf Z-Ebene 2
|
|
||||||
accountContainer.setLocalTranslation(accountContainer.getLocalTranslation().x, accountContainer.getLocalTranslation().y, 5);
|
|
||||||
|
|
||||||
// Setze overviewContainer auf Z-Ebene 2
|
|
||||||
overviewContainer.setLocalTranslation(overviewContainer.getLocalTranslation().x, overviewContainer.getLocalTranslation().y, 5);
|
|
||||||
|
|
||||||
accountContainer.setBackground(null);
|
accountContainer.setBackground(null);
|
||||||
|
|
||||||
overviewContainer.addChild(new Label("Übersicht", new ElementId("label-toolbar")));
|
overviewContainer.addChild(new Label("Übersicht", new ElementId("label-toolbar")));
|
||||||
@ -528,19 +431,11 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
@Override
|
@Override
|
||||||
public void receivedEvent(ButtonStatusEvent event) {
|
public void receivedEvent(ButtonStatusEvent event) {
|
||||||
boolean enabled = event.buttonsEnabled();
|
boolean enabled = event.buttonsEnabled();
|
||||||
if (diceButton != null) {
|
|
||||||
diceButton.setEnabled(enabled);
|
diceButton.setEnabled(enabled);
|
||||||
}
|
|
||||||
if (tradeButton != null) {
|
|
||||||
tradeButton.setEnabled(enabled);
|
tradeButton.setEnabled(enabled);
|
||||||
}
|
|
||||||
if (propertyMenuButton != null) {
|
|
||||||
propertyMenuButton.setEnabled(enabled);
|
propertyMenuButton.setEnabled(enabled);
|
||||||
}
|
|
||||||
if (endTurnButton != null) {
|
|
||||||
endTurnButton.setEnabled(false);
|
endTurnButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the toolbar and detaches it from the GUI.
|
* Closes the toolbar and detaches it from the GUI.
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 80 KiB |
Binary file not shown.
Before Width: | Height: | Size: 58 KiB |
Binary file not shown.
Before Width: | Height: | Size: 58 KiB |
Binary file not shown.
Before Width: | Height: | Size: 72 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 190 KiB |
Loading…
Reference in New Issue
Block a user