From f333e2d2c0aa946cd5895e42b7819e9f6464c2ff Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Sun, 1 Dec 2024 00:30:50 +0100 Subject: [PATCH] button function --- .../client/gui/BuildingAdminMenu.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java index ab3f85c..a96d8e2 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java @@ -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();