Merge remote-tracking branch 'origin/gui' into gui

This commit is contained in:
Yvonne Schmidt 2024-12-01 00:35:27 +01:00
commit 79c96677bd

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();