mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-28 23:39:45 +01:00
abbrechen button in chossePatner
This commit is contained in:
parent
840658b590
commit
7b91a679f5
@ -1,7 +1,5 @@
|
||||
package pp.monopoly.client.gui;
|
||||
|
||||
import com.jme3.app.Application;
|
||||
import com.jme3.app.state.BaseAppState;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
@ -11,20 +9,16 @@ import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.Axis;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.Insets3f;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.Selector;
|
||||
import com.simsilica.lemur.TextField;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import com.simsilica.lemur.component.SpringGridLayout;
|
||||
import com.simsilica.lemur.core.VersionedList;
|
||||
import com.simsilica.lemur.core.VersionedReference;
|
||||
import com.simsilica.lemur.style.ElementId;
|
||||
import pp.dialog.Dialog;
|
||||
import pp.monopoly.client.MonopolyApp;
|
||||
import pp.monopoly.notification.Sound;
|
||||
|
||||
import java.util.Set;
|
||||
public class ChoosePartner extends Dialog {
|
||||
private final MonopolyApp app;
|
||||
private Selector<String> playerSelector;
|
||||
@ -33,6 +27,7 @@ public class ChoosePartner extends Dialog {
|
||||
private final Container mainContainer;
|
||||
private Container lowerLeftMenu;
|
||||
private Container lowerRightMenu;
|
||||
private Geometry background;
|
||||
QuadBackgroundComponent translucentWhiteBackground =
|
||||
new QuadBackgroundComponent(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f));
|
||||
|
||||
@ -70,7 +65,7 @@ public class ChoosePartner extends Dialog {
|
||||
mainContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - mainContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + mainContainer.getPreferredSize().y) / 2,
|
||||
3
|
||||
4
|
||||
);
|
||||
}
|
||||
|
||||
@ -116,8 +111,7 @@ public class ChoosePartner extends Dialog {
|
||||
cancelButton.setFontSize(30);
|
||||
cancelButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
this.close();
|
||||
new Toolbar(app).open();
|
||||
close();
|
||||
}));
|
||||
lowerLeftMenu.addChild(cancelButton);
|
||||
|
||||
@ -134,7 +128,7 @@ public class ChoosePartner extends Dialog {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
String selectedPlayer = playerSelector.getSelectedItem();
|
||||
System.out.println("Selected player: " + selectedPlayer);
|
||||
this.close();
|
||||
close();
|
||||
// TODO: Open trade menu or next step
|
||||
}));
|
||||
lowerRightMenu.addChild(confirmButton);
|
||||
@ -153,11 +147,11 @@ public class ChoosePartner 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);
|
||||
background.setLocalTranslation(0, 0, 1); // Position behind other GUI elements
|
||||
background.setLocalTranslation(0, 0, 3); // Position behind other GUI elements
|
||||
app.getGuiNode().attachChild(background);
|
||||
}
|
||||
|
||||
@ -178,6 +172,16 @@ public class ChoosePartner extends Dialog {
|
||||
public void update(float delta) {
|
||||
// Periodic updates (if needed) can be implemented here
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
app.getGuiNode().detachChild(playerSelector);
|
||||
app.getGuiNode().detachChild(lowerLeftMenu);
|
||||
app.getGuiNode().detachChild(lowerRightMenu);
|
||||
app.getGuiNode().detachChild(mainContainer);
|
||||
app.getGuiNode().detachChild(background);
|
||||
super.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,7 +166,6 @@ public class Toolbar extends Dialog {
|
||||
tradebutton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
|
||||
tradebutton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
this.close();
|
||||
new ChoosePartner(app).open();
|
||||
}));
|
||||
return tradebutton;
|
||||
|
Loading…
Reference in New Issue
Block a user