Compare commits

...

7 Commits

Author SHA1 Message Date
Luca Puderbach
f3ec17b0b1 Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-12-01 00:39:05 +01:00
Luca Puderbach
1c31915627 Werkzeugbank Rand 2024-12-01 00:39:00 +01:00
Yvonne Schmidt
79c96677bd Merge remote-tracking branch 'origin/gui' into gui 2024-12-01 00:35:27 +01:00
Yvonne Schmidt
54118071cb fixed popup overlap 2024-12-01 00:34:57 +01:00
Johannes Schmelz
2e28b54936 Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-12-01 00:30:55 +01:00
Johannes Schmelz
f333e2d2c0 button function 2024-12-01 00:30:50 +01:00
Yvonne Schmidt
b89d40b39f fixed nullPointer 2024-12-01 00:14:04 +01:00
7 changed files with 61 additions and 17 deletions

View File

@ -12,12 +12,17 @@ import com.simsilica.lemur.component.SpringGridLayout;
import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog;
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;
public class BuildingAdminMenu extends Dialog {
private final MonopolyApp app;
private final Container mainContainer;
private Geometry background;
private final Button backButton = new Button("Zurück");
private final Button buildButton = new Button("Bauen");
private final Button demolishButton = new Button("Abriss");
@ -81,6 +86,7 @@ public class BuildingAdminMenu extends Dialog {
overviewButton.setPreferredSize(new Vector3f(200, 50, 0));
overviewButton.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON);
new PropertyOverviewMenu(app).open();
}));
overviewColumn.addChild(overviewButton);
@ -88,7 +94,7 @@ public class BuildingAdminMenu extends Dialog {
backButton.setPreferredSize(new Vector3f(200, 50, 0));
backButton.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON);
this.close();
close();
}));
overviewColumn.addChild(backButton);
@ -103,6 +109,7 @@ public class BuildingAdminMenu extends Dialog {
buildButton.setPreferredSize(new Vector3f(200, 50, 0));
buildButton.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON);
new BuyHouse(app).open();
}));
buildColumn.addChild(buildButton);
@ -110,6 +117,7 @@ public class BuildingAdminMenu extends Dialog {
demolishButton.setPreferredSize(new Vector3f(200, 50, 0));
demolishButton.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON);
new SellHouse(app).open();
}));
buildColumn.addChild(demolishButton);
@ -124,6 +132,7 @@ public class BuildingAdminMenu extends Dialog {
takeMortgageButton.setPreferredSize(new Vector3f(200, 50, 0));
takeMortgageButton.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON);
new TakeMortage(app).open();
}));
mortgageColumn.addChild(takeMortgageButton);
@ -131,8 +140,9 @@ public class BuildingAdminMenu extends Dialog {
payMortgageButton.setPreferredSize(new Vector3f(200, 50, 0));
payMortgageButton.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON);
new RepayMortage(app).open();
}));
mortgageColumn.addChild(payMortgageButton);
mortgageColumn.addChild(payMortgageButton);
contentContainer.addChild(mortgageColumn);
@ -145,7 +155,7 @@ public class BuildingAdminMenu extends Dialog {
private void addBackgroundImage() {
Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png");
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");
backgroundMaterial.setTexture("ColorMap", backgroundImage);
background.setMaterial(backgroundMaterial);
@ -161,6 +171,13 @@ public class BuildingAdminMenu extends Dialog {
close();
}
@Override
public void close() {
app.getGuiNode().detachChild(mainContainer);
app.getGuiNode().detachChild(background);
super.close();
}
@Override
public void escape() {
handleBack();

View File

@ -95,8 +95,14 @@ public class PropertyOverviewMenu extends Dialog {
// Fetch the current player
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
// Iterate through the player's properties
for (PropertyField property : currentPlayer.getPropertyFields()) {
// Fetch the player's properties using their indices
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) {
BuildingProperty building = (BuildingProperty) property;
cards.add(createBuildingCard(building));

View File

@ -15,7 +15,6 @@ import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.game.server.Player;
import pp.monopoly.game.server.PlayerColor;
import pp.monopoly.game.server.PlayerHandler;
import pp.monopoly.message.client.EndTurn;
import pp.monopoly.message.client.RollDice;
@ -63,13 +62,35 @@ public class Toolbar extends Dialog implements GameEventListener {
Player currentPlayer = playerHandler.getPlayerById(app.getId());
ColorRGBA playerColor = currentPlayer.getColor().getColor();
// Füge einen farbigen Balken hinzu
// Oberer Balken
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.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);
// 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
accountContainer = container.addChild(new Container());
overviewContainer = container.addChild(new Container());

View File

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

View File

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

View File

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

View File

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