mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-28 23:39:45 +01:00
Gebäude_Abreißen erstellt
This commit is contained in:
parent
5e0ac0abc7
commit
970a0ae254
@ -275,7 +275,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
|||||||
//logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen
|
//logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen
|
||||||
private void handleB(boolean isPressed) {
|
private void handleB(boolean isPressed) {
|
||||||
if (isPressed) {
|
if (isPressed) {
|
||||||
Dialog tmp = new ConfirmTrade(this);
|
Dialog tmp = new SellHouse(this);
|
||||||
tmp.open();
|
tmp.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class ConfirmTrade extends Dialog {
|
|||||||
confirmTradeContainer = new Container();
|
confirmTradeContainer = new Container();
|
||||||
|
|
||||||
|
|
||||||
Label title = confirmTradeContainer.addChild(new Label( "Handel", new ElementId("label-Bold")));
|
Label title = confirmTradeContainer.addChild(new Label( "Handel", new ElementId("label-Bold"))); //TODO ggf die Buttons Sprachabhängig von den Properties machen
|
||||||
title.setFontSize(48);
|
title.setFontSize(48);
|
||||||
title.setColor(ColorRGBA.Black);
|
title.setColor(ColorRGBA.Black);
|
||||||
|
|
||||||
|
@ -0,0 +1,117 @@
|
|||||||
|
package pp.monopoly.client.gui.popups;
|
||||||
|
|
||||||
|
import com.jme3.math.ColorRGBA;
|
||||||
|
import com.jme3.math.Vector2f;
|
||||||
|
import com.jme3.math.Vector3f;
|
||||||
|
import com.simsilica.lemur.Button;
|
||||||
|
import com.simsilica.lemur.Container;
|
||||||
|
import com.simsilica.lemur.Label;
|
||||||
|
import com.simsilica.lemur.component.IconComponent;
|
||||||
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
|
import com.simsilica.lemur.style.ElementId;
|
||||||
|
import pp.dialog.Dialog;
|
||||||
|
import pp.monopoly.client.MonopolyApp;
|
||||||
|
import pp.monopoly.client.gui.SettingsMenu;
|
||||||
|
import pp.monopoly.message.client.BuyPropertyRequest;
|
||||||
|
import pp.monopoly.notification.Sound;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
|
||||||
|
*/
|
||||||
|
public class SellHouse extends Dialog {
|
||||||
|
private final MonopolyApp app;
|
||||||
|
private final Container sellhouseContainer;
|
||||||
|
private final Container backgroundContainer;
|
||||||
|
|
||||||
|
|
||||||
|
public SellHouse(MonopolyApp app) {
|
||||||
|
super(app.getDialogManager());
|
||||||
|
this.app = app;
|
||||||
|
|
||||||
|
//Generate the corresponfing field
|
||||||
|
//int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();;
|
||||||
|
// BuildingProperty field = (BuildingProperty) new BoardManager().getFieldAtIndex(index);
|
||||||
|
|
||||||
|
// Create the background container
|
||||||
|
backgroundContainer = new Container();
|
||||||
|
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
|
||||||
|
attachChild(backgroundContainer);
|
||||||
|
|
||||||
|
// Hauptcontainer für die Gebäudekarte
|
||||||
|
sellhouseContainer = new Container();
|
||||||
|
|
||||||
|
|
||||||
|
Label title = sellhouseContainer.addChild(new Label( "Gebäude Abreißen", new ElementId("label-Bold"))); //TODO ggf die Buttons Sprachabhängig von den Properties machen
|
||||||
|
title.setFontSize(48);
|
||||||
|
title.setColor(ColorRGBA.Black);
|
||||||
|
|
||||||
|
Container upContainer = sellhouseContainer.addChild(new Container());
|
||||||
|
Container middleContainer = sellhouseContainer.addChild(new Container());
|
||||||
|
Container downContainer = sellhouseContainer.addChild(new Container());
|
||||||
|
|
||||||
|
// Text, der auf der Karte steht
|
||||||
|
// Die Preise werden dynamisch dem BoardManager entnommen
|
||||||
|
upContainer.addChild(new Label("„Grundstück wählen:", new ElementId("label-Text"))); //TODO hier überall die entsprechenden Variablen einfügen
|
||||||
|
upContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
|
||||||
|
upContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
|
middleContainer.setPreferredSize(new Vector3f(100, 150, 0));
|
||||||
|
middleContainer.setBackground(new QuadBackgroundComponent(ColorRGBA.Red));
|
||||||
|
middleContainer.addChild(new Label("Dies ist ein Container", new ElementId("label-Text")));
|
||||||
|
middleContainer.addChild(new Label("", new ElementId("label-Text")));
|
||||||
|
middleContainer.addChild(new Label("Hier kann der Slider und die Checkbocen eingefügt werden", new ElementId("label-Text")));
|
||||||
|
downContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
|
||||||
|
downContainer.addChild(new Label("Erstattung:", new ElementId("label-Text")));// Leerzeile
|
||||||
|
downContainer.addChild(new Label("Hier die tätsächliche Erstattung", new ElementId("label-Text")));
|
||||||
|
downContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
|
|
||||||
|
// Beenden-Button
|
||||||
|
Button cancelButton = sellhouseContainer.addChild(new Button("Abbrechen", new ElementId("button"))); //TODO ggf die Buttons Sprachabhängig von den Properties machen
|
||||||
|
cancelButton.setFontSize(32);
|
||||||
|
cancelButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
close();
|
||||||
|
}));
|
||||||
|
// Kaufen-Button
|
||||||
|
Button confirmButton = sellhouseContainer.addChild(new Button("Bestätigen", new ElementId("button"))); //TODO ggf die Buttons Sprachabhängig von den Properties machen
|
||||||
|
confirmButton.setFontSize(32);
|
||||||
|
confirmButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||||
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
app.getGameLogic().send(new BuyPropertyRequest());
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
float padding = 10; // Padding around the settingsContainer for the background
|
||||||
|
backgroundContainer.setPreferredSize(sellhouseContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||||
|
|
||||||
|
|
||||||
|
// Zentriere das Menü
|
||||||
|
sellhouseContainer.setLocalTranslation(
|
||||||
|
(app.getCamera().getWidth() - sellhouseContainer.getPreferredSize().x) / 2,
|
||||||
|
(app.getCamera().getHeight() + sellhouseContainer.getPreferredSize().y) / 2,
|
||||||
|
8
|
||||||
|
);
|
||||||
|
|
||||||
|
backgroundContainer.setLocalTranslation(
|
||||||
|
(app.getCamera().getWidth() - sellhouseContainer.getPreferredSize().x - padding) / 2,
|
||||||
|
(app.getCamera().getHeight() + sellhouseContainer.getPreferredSize().y+ padding) / 2,
|
||||||
|
7
|
||||||
|
);
|
||||||
|
|
||||||
|
app.getGuiNode().attachChild(sellhouseContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schließt das Menü und entfernt die GUI-Elemente.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
app.getGuiNode().detachChild(sellhouseContainer); // Entferne das Menü
|
||||||
|
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||||
|
super.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void escape() {
|
||||||
|
new SettingsMenu(app).open();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user