fixed BuildingAdminMenu

This commit is contained in:
Yvonne Schmidt 2024-11-29 23:07:58 +01:00
parent fba82f670b
commit 05680af726

View File

@ -24,7 +24,6 @@ public class BuildingAdminMenu extends Dialog {
private final Button takeMortgageButton = new Button("Hypothek aufnehmen");
private final Button payMortgageButton = new Button("Hypothek bezahlen");
private final Button overviewButton = new Button("Übersicht");
private Geometry background;
public BuildingAdminMenu(MonopolyApp app) {
super(app.getDialogManager());
@ -43,7 +42,7 @@ public class BuildingAdminMenu extends Dialog {
// Add content
mainContainer.addChild(createContent());
// Attach main container to GUI node
attachChild(mainContainer);
app.getGuiNode().attachChild(mainContainer);
mainContainer.setLocalTranslation(
(app.getCamera().getWidth() - mainContainer.getPreferredSize().x) / 2,
(app.getCamera().getHeight() + mainContainer.getPreferredSize().y) / 2,
@ -82,7 +81,6 @@ 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);
@ -147,23 +145,29 @@ 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());
background = new Geometry("Background", quad);
Geometry background = new Geometry("Background", quad);
Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
backgroundMaterial.setTexture("ColorMap", backgroundImage);
background.setMaterial(backgroundMaterial);
background.setLocalTranslation(0, 0, 6); // Position behind other GUI elements
attachChild(background);
app.getGuiNode().attachChild(background);
}
/**
* Handles the "Zurück" action.
*/
private void handleBack() {
app.getGameLogic().playSound(Sound.BUTTON);
close();
}
@Override
public void escape() {
new SettingsMenu(app).open();
handleBack();
}
@Override
public void close() {
detachChild(background);
detachChild(mainContainer);
super.close();
public void update(float delta) {
// Periodic updates if necessary
}
}
}