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