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
7 Commits
488ae154cf
...
f3ec17b0b1
Author | SHA1 | Date | |
---|---|---|---|
|
f3ec17b0b1 | ||
|
1c31915627 | ||
|
79c96677bd | ||
|
54118071cb | ||
|
2e28b54936 | ||
|
f333e2d2c0 | ||
|
b89d40b39f |
@ -12,12 +12,17 @@ import com.simsilica.lemur.component.SpringGridLayout;
|
|||||||
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;
|
||||||
|
import pp.monopoly.client.gui.popups.BuyHouse;
|
||||||
|
import pp.monopoly.client.gui.popups.RepayMortage;
|
||||||
|
import pp.monopoly.client.gui.popups.SellHouse;
|
||||||
|
import pp.monopoly.client.gui.popups.TakeMortage;
|
||||||
import pp.monopoly.notification.Sound;
|
import pp.monopoly.notification.Sound;
|
||||||
|
|
||||||
public class BuildingAdminMenu extends Dialog {
|
public class BuildingAdminMenu extends Dialog {
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
|
|
||||||
private final Container mainContainer;
|
private final Container mainContainer;
|
||||||
|
private Geometry background;
|
||||||
private final Button backButton = new Button("Zurück");
|
private final Button backButton = new Button("Zurück");
|
||||||
private final Button buildButton = new Button("Bauen");
|
private final Button buildButton = new Button("Bauen");
|
||||||
private final Button demolishButton = new Button("Abriss");
|
private final Button demolishButton = new Button("Abriss");
|
||||||
@ -81,6 +86,7 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
overviewButton.setPreferredSize(new Vector3f(200, 50, 0));
|
overviewButton.setPreferredSize(new Vector3f(200, 50, 0));
|
||||||
overviewButton.addClickCommands(s -> ifTopDialog(() -> {
|
overviewButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
new PropertyOverviewMenu(app).open();
|
||||||
}));
|
}));
|
||||||
overviewColumn.addChild(overviewButton);
|
overviewColumn.addChild(overviewButton);
|
||||||
|
|
||||||
@ -88,7 +94,7 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
backButton.setPreferredSize(new Vector3f(200, 50, 0));
|
backButton.setPreferredSize(new Vector3f(200, 50, 0));
|
||||||
backButton.addClickCommands(s -> ifTopDialog(() -> {
|
backButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
this.close();
|
close();
|
||||||
}));
|
}));
|
||||||
overviewColumn.addChild(backButton);
|
overviewColumn.addChild(backButton);
|
||||||
|
|
||||||
@ -103,6 +109,7 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
buildButton.setPreferredSize(new Vector3f(200, 50, 0));
|
buildButton.setPreferredSize(new Vector3f(200, 50, 0));
|
||||||
buildButton.addClickCommands(s -> ifTopDialog(() -> {
|
buildButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
new BuyHouse(app).open();
|
||||||
}));
|
}));
|
||||||
buildColumn.addChild(buildButton);
|
buildColumn.addChild(buildButton);
|
||||||
|
|
||||||
@ -110,6 +117,7 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
demolishButton.setPreferredSize(new Vector3f(200, 50, 0));
|
demolishButton.setPreferredSize(new Vector3f(200, 50, 0));
|
||||||
demolishButton.addClickCommands(s -> ifTopDialog(() -> {
|
demolishButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
new SellHouse(app).open();
|
||||||
}));
|
}));
|
||||||
buildColumn.addChild(demolishButton);
|
buildColumn.addChild(demolishButton);
|
||||||
|
|
||||||
@ -124,6 +132,7 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
takeMortgageButton.setPreferredSize(new Vector3f(200, 50, 0));
|
takeMortgageButton.setPreferredSize(new Vector3f(200, 50, 0));
|
||||||
takeMortgageButton.addClickCommands(s -> ifTopDialog(() -> {
|
takeMortgageButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
new TakeMortage(app).open();
|
||||||
}));
|
}));
|
||||||
mortgageColumn.addChild(takeMortgageButton);
|
mortgageColumn.addChild(takeMortgageButton);
|
||||||
|
|
||||||
@ -131,6 +140,7 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
payMortgageButton.setPreferredSize(new Vector3f(200, 50, 0));
|
payMortgageButton.setPreferredSize(new Vector3f(200, 50, 0));
|
||||||
payMortgageButton.addClickCommands(s -> ifTopDialog(() -> {
|
payMortgageButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
new RepayMortage(app).open();
|
||||||
}));
|
}));
|
||||||
mortgageColumn.addChild(payMortgageButton);
|
mortgageColumn.addChild(payMortgageButton);
|
||||||
|
|
||||||
@ -145,7 +155,7 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
private void addBackgroundImage() {
|
private void addBackgroundImage() {
|
||||||
Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png");
|
Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png");
|
||||||
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
|
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
|
||||||
Geometry background = new Geometry("Background", quad);
|
background = new Geometry("Background", quad);
|
||||||
Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||||
backgroundMaterial.setTexture("ColorMap", backgroundImage);
|
backgroundMaterial.setTexture("ColorMap", backgroundImage);
|
||||||
background.setMaterial(backgroundMaterial);
|
background.setMaterial(backgroundMaterial);
|
||||||
@ -161,6 +171,13 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
app.getGuiNode().detachChild(mainContainer);
|
||||||
|
app.getGuiNode().detachChild(background);
|
||||||
|
super.close();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void escape() {
|
public void escape() {
|
||||||
handleBack();
|
handleBack();
|
||||||
|
@ -95,8 +95,14 @@ public class PropertyOverviewMenu extends Dialog {
|
|||||||
// Fetch the current player
|
// Fetch the current player
|
||||||
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
|
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
|
||||||
|
|
||||||
// Iterate through the player's properties
|
// Fetch the player's properties using their indices
|
||||||
for (PropertyField property : currentPlayer.getPropertyFields()) {
|
List<PropertyField> fields = new ArrayList<>();
|
||||||
|
for (Integer i : currentPlayer.getProperties()) {
|
||||||
|
fields.add((PropertyField) app.getGameLogic().getBoardManager().getFieldAtIndex(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate through the fetched properties
|
||||||
|
for (PropertyField property : fields) {
|
||||||
if (property instanceof BuildingProperty) {
|
if (property instanceof BuildingProperty) {
|
||||||
BuildingProperty building = (BuildingProperty) property;
|
BuildingProperty building = (BuildingProperty) property;
|
||||||
cards.add(createBuildingCard(building));
|
cards.add(createBuildingCard(building));
|
||||||
|
@ -15,7 +15,6 @@ import com.simsilica.lemur.style.ElementId;
|
|||||||
import pp.dialog.Dialog;
|
import pp.dialog.Dialog;
|
||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
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;
|
||||||
@ -63,13 +62,35 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
Player currentPlayer = playerHandler.getPlayerById(app.getId());
|
Player currentPlayer = playerHandler.getPlayerById(app.getId());
|
||||||
ColorRGBA playerColor = currentPlayer.getColor().getColor();
|
ColorRGBA playerColor = currentPlayer.getColor().getColor();
|
||||||
|
|
||||||
// Füge einen farbigen Balken hinzu
|
// Oberer Balken
|
||||||
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(), 15, 0)); // Höhe des oberen Balkens
|
||||||
playerColorBar.setBackground(new QuadBackgroundComponent(playerColor));
|
playerColorBar.setBackground(new QuadBackgroundComponent(playerColor));
|
||||||
playerColorBar.setLocalTranslation(0, 220, 1); // Positioniere ihn an der oberen Kante der Toolbar
|
playerColorBar.setLocalTranslation(0, 210, 1); // Position über der Toolbar
|
||||||
app.getGuiNode().attachChild(playerColorBar);
|
app.getGuiNode().attachChild(playerColorBar);
|
||||||
|
|
||||||
|
// unterer Balken
|
||||||
|
Container playerColorBarbot = new Container();
|
||||||
|
playerColorBarbot.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 10, 0)); // Höhe des oberen Balkens
|
||||||
|
playerColorBarbot.setBackground(new QuadBackgroundComponent(playerColor));
|
||||||
|
playerColorBarbot.setLocalTranslation(0, 10, 3); // Position über der Toolbar
|
||||||
|
app.getGuiNode().attachChild(playerColorBarbot);
|
||||||
|
|
||||||
|
|
||||||
|
// Linker Balken
|
||||||
|
Container leftBar = new Container();
|
||||||
|
leftBar.setPreferredSize(new Vector3f(10, 210, 0)); // Breite 10, Höhe 210
|
||||||
|
leftBar.setBackground(new QuadBackgroundComponent(playerColor));
|
||||||
|
leftBar.setLocalTranslation(0, 200, 3); // Position am linken Rand
|
||||||
|
app.getGuiNode().attachChild(leftBar);
|
||||||
|
|
||||||
|
// Rechter Balken
|
||||||
|
Container rightBar = new Container();
|
||||||
|
rightBar.setPreferredSize(new Vector3f(10, 210, 0)); // Breite 10, Höhe 210
|
||||||
|
rightBar.setBackground(new QuadBackgroundComponent(playerColor));
|
||||||
|
rightBar.setLocalTranslation(app.getCamera().getWidth() - 10, 200, 2); // Position am rechten Rand
|
||||||
|
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());
|
||||||
|
@ -125,14 +125,14 @@ 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,
|
||||||
8
|
9
|
||||||
);
|
);
|
||||||
|
|
||||||
// Zentriere das Popup
|
// Zentriere das Popup
|
||||||
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,
|
||||||
7
|
8
|
||||||
);
|
);
|
||||||
|
|
||||||
app.getGuiNode().attachChild(buyHouseContainer);
|
app.getGuiNode().attachChild(buyHouseContainer);
|
||||||
|
@ -125,14 +125,14 @@ public class RepayMortage extends Dialog {
|
|||||||
repayMortageContainer.setLocalTranslation(
|
repayMortageContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - repayMortageContainer.getPreferredSize().x) / 2,
|
(app.getCamera().getWidth() - repayMortageContainer.getPreferredSize().x) / 2,
|
||||||
(app.getCamera().getHeight() + repayMortageContainer.getPreferredSize().y) / 2,
|
(app.getCamera().getHeight() + repayMortageContainer.getPreferredSize().y) / 2,
|
||||||
8
|
9
|
||||||
);
|
);
|
||||||
|
|
||||||
// Zentriere das Popup
|
// Zentriere das Popup
|
||||||
backgroundContainer.setLocalTranslation(
|
backgroundContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - repayMortageContainer.getPreferredSize().x - padding) / 2,
|
(app.getCamera().getWidth() - repayMortageContainer.getPreferredSize().x - padding) / 2,
|
||||||
(app.getCamera().getHeight() + repayMortageContainer.getPreferredSize().y+ padding) / 2,
|
(app.getCamera().getHeight() + repayMortageContainer.getPreferredSize().y+ padding) / 2,
|
||||||
7
|
8
|
||||||
);
|
);
|
||||||
|
|
||||||
app.getGuiNode().attachChild(repayMortageContainer);
|
app.getGuiNode().attachChild(repayMortageContainer);
|
||||||
|
@ -129,14 +129,14 @@ public class SellHouse extends Dialog {
|
|||||||
sellhouseContainer.setLocalTranslation(
|
sellhouseContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - sellhouseContainer.getPreferredSize().x) / 2,
|
(app.getCamera().getWidth() - sellhouseContainer.getPreferredSize().x) / 2,
|
||||||
(app.getCamera().getHeight() + sellhouseContainer.getPreferredSize().y) / 2,
|
(app.getCamera().getHeight() + sellhouseContainer.getPreferredSize().y) / 2,
|
||||||
8
|
9
|
||||||
);
|
);
|
||||||
|
|
||||||
// Zentriere das Popup
|
// Zentriere das Popup
|
||||||
backgroundContainer.setLocalTranslation(
|
backgroundContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - sellhouseContainer.getPreferredSize().x - padding) / 2,
|
(app.getCamera().getWidth() - sellhouseContainer.getPreferredSize().x - padding) / 2,
|
||||||
(app.getCamera().getHeight() + sellhouseContainer.getPreferredSize().y+ padding) / 2,
|
(app.getCamera().getHeight() + sellhouseContainer.getPreferredSize().y+ padding) / 2,
|
||||||
7
|
8
|
||||||
);
|
);
|
||||||
|
|
||||||
app.getGuiNode().attachChild(sellhouseContainer);
|
app.getGuiNode().attachChild(sellhouseContainer);
|
||||||
|
@ -125,14 +125,14 @@ public class TakeMortage extends Dialog {
|
|||||||
takeMortageContainer.setLocalTranslation(
|
takeMortageContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - takeMortageContainer.getPreferredSize().x) / 2,
|
(app.getCamera().getWidth() - takeMortageContainer.getPreferredSize().x) / 2,
|
||||||
(app.getCamera().getHeight() + takeMortageContainer.getPreferredSize().y) / 2,
|
(app.getCamera().getHeight() + takeMortageContainer.getPreferredSize().y) / 2,
|
||||||
8
|
9
|
||||||
);
|
);
|
||||||
|
|
||||||
// Zentriere das Popup
|
// Zentriere das Popup
|
||||||
backgroundContainer.setLocalTranslation(
|
backgroundContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - takeMortageContainer.getPreferredSize().x - padding) / 2,
|
(app.getCamera().getWidth() - takeMortageContainer.getPreferredSize().x - padding) / 2,
|
||||||
(app.getCamera().getHeight() + takeMortageContainer.getPreferredSize().y+ padding) / 2,
|
(app.getCamera().getHeight() + takeMortageContainer.getPreferredSize().y+ padding) / 2,
|
||||||
7
|
8
|
||||||
);
|
);
|
||||||
|
|
||||||
app.getGuiNode().attachChild(takeMortageContainer);
|
app.getGuiNode().attachChild(takeMortageContainer);
|
||||||
|
Loading…
Reference in New Issue
Block a user