mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-04-17 12:40:59 +02:00
Compare commits
No commits in common. "88409dcc99f48955edcab420b572141f2ad6c1de" and "72cb7049baaa4b6ecf28fe7d380622f4863720ed" have entirely different histories.
88409dcc99
...
72cb7049ba
@ -136,7 +136,6 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
private boolean isBuyCardPopupOpen = false;
|
||||
private final ActionListener BListener = (name, isPressed, tpf) -> handleB(isPressed);
|
||||
private final ActionListener TListener = (name, isPressed, tpf) -> handleT(isPressed);
|
||||
private TestWorld testWorld;
|
||||
|
||||
static {
|
||||
// Configure logging
|
||||
@ -297,8 +296,8 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
//logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen
|
||||
private void handleT(boolean isPressed) {
|
||||
if (isPressed) {
|
||||
testWorld = new TestWorld(this);
|
||||
testWorld.initializeScene();
|
||||
TestWorld tmp = new TestWorld(this);
|
||||
tmp.initializeScene();
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,11 +350,6 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
super.simpleUpdate(tpf);
|
||||
dialogManager.update(tpf);
|
||||
logic.update(tpf);
|
||||
|
||||
//TODO testing replace later
|
||||
if (testWorld != null) {
|
||||
testWorld.update(tpf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,64 +0,0 @@
|
||||
package pp.monopoly.client.gui;
|
||||
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.shape.Quad;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.Axis;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.TextField;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import com.simsilica.lemur.component.SpringGridLayout;
|
||||
import com.simsilica.lemur.style.ElementId;
|
||||
import pp.dialog.Dialog;
|
||||
import pp.monopoly.client.MonopolyApp;
|
||||
|
||||
public class ChoosePartner extends Dialog {
|
||||
|
||||
private final MonopolyApp app;
|
||||
private final Container menuContainer;
|
||||
private Geometry background;
|
||||
|
||||
|
||||
public ChoosePartner(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
this.app = app;
|
||||
|
||||
// Hintergrundbild laden und hinzufügen
|
||||
addBackgroundImage();
|
||||
|
||||
QuadBackgroundComponent translucentWhiteBackground =
|
||||
new QuadBackgroundComponent(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f));
|
||||
|
||||
menuContainer = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
||||
menuContainer.setPreferredSize(new Vector3f(1000, 600, 0)); // Fixed size of the container
|
||||
menuContainer.setBackground(translucentWhiteBackground);
|
||||
|
||||
// Create a smaller horizontal container for the label, input field, and spacers
|
||||
Container horizontalContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y)));
|
||||
horizontalContainer.setPreferredSize(new Vector3f(600, 40, 0)); // Adjust container size
|
||||
horizontalContainer.setBackground(null);
|
||||
|
||||
Label title = horizontalContainer.addChild(new Label("Wähle deinen Handelspartner:", new ElementId("label-Bold")));
|
||||
title.setFontSize(40);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Lädt das Hintergrundbild und fügt es als geometrische Ebene hinzu.
|
||||
*/
|
||||
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);
|
||||
Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
backgroundMaterial.setTexture("ColorMap", backgroundImage);
|
||||
background.setMaterial(backgroundMaterial);
|
||||
background.setLocalTranslation(0, 0, -1); // Hintergrundebene
|
||||
|
||||
app.getGuiNode().attachChild(background);
|
||||
}
|
||||
}
|
@ -6,16 +6,11 @@ import java.util.Random;
|
||||
import com.jme3.font.BitmapText;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.simsilica.lemur.Axis;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.Panel;
|
||||
import com.simsilica.lemur.*;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import com.simsilica.lemur.component.SpringGridLayout;
|
||||
|
||||
import com.simsilica.lemur.style.ElementId;
|
||||
|
||||
import pp.dialog.Dialog;
|
||||
import pp.monopoly.client.MonopolyApp;
|
||||
import pp.monopoly.notification.Sound;
|
||||
@ -86,41 +81,11 @@ public class Toolbar extends Dialog {
|
||||
|
||||
// Menü-Container: Ein Container für Würfel
|
||||
Container diceContainer = toolbarContainer.addChild(new Container());
|
||||
diceContainer.setLayout(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
|
||||
// Create a horizontal container to align leftContainer and rightContainer side by side
|
||||
Container horizontalContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
horizontalContainer.setPreferredSize(new Vector3f(200, 150, 0)); // Adjust size as needed
|
||||
|
||||
// Create the first container (leftContainer)
|
||||
Container leftContainer = new Container();
|
||||
leftContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed
|
||||
leftContainer.addChild(new Label("Left Container", new ElementId("label")));
|
||||
leftContainer.addChild(new Button("Button 1"));
|
||||
|
||||
// Create the second container (rightContainer)
|
||||
Container rightContainer = new Container();
|
||||
rightContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed
|
||||
rightContainer.addChild(new Label("Right Container", new ElementId("label")));
|
||||
rightContainer.addChild(new Button("Button 2"));
|
||||
|
||||
// Add leftContainer and rightContainer to the horizontal container
|
||||
horizontalContainer.addChild(leftContainer);
|
||||
horizontalContainer.addChild(rightContainer);
|
||||
|
||||
// Add the horizontalContainer to the diceContainer (top section)
|
||||
diceContainer.addChild(horizontalContainer);
|
||||
|
||||
// Add the Würfeln button directly below the horizontalContainer
|
||||
Button diceButton = new Button("Würfeln");
|
||||
diceButton.setPreferredSize(new Vector3f(200, 50, 0)); // Full width for Würfeln button
|
||||
diceButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
rollDice();
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
}));
|
||||
diceContainer.addChild(diceButton);
|
||||
|
||||
|
||||
diceContainer.setPreferredSize(new Vector3f(400, 150, 0));
|
||||
diceContainer.addChild(new Label("Wo Würfel?", new ElementId("label")));
|
||||
diceContainer.addChild(addDiceRollButton());
|
||||
diceContainer.setBackground(null);
|
||||
|
||||
|
||||
// Menü-Container: Ein Nested-Container für Handeln, Grundstücke und Zug beenden
|
||||
@ -179,15 +144,12 @@ public class Toolbar extends Dialog {
|
||||
private void addTradeMenuButton() {
|
||||
Button diceButton = new Button("Handeln");
|
||||
diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
|
||||
diceButton.addClickCommands(s -> {
|
||||
diceButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
rollDice();
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
this.close();
|
||||
System.out.println("test");
|
||||
new ChoosePartner(app).open();
|
||||
});
|
||||
}));
|
||||
toolbarContainer.addChild(diceButton);
|
||||
}// TODO Funktion der Buttons Überarbeiten und prüfen
|
||||
}
|
||||
|
||||
private void addEndTurnButton() {
|
||||
Button diceButton = new Button("Grundstücke");
|
||||
@ -261,15 +223,11 @@ public class Toolbar extends Dialog {
|
||||
positionText.setText("Feld-ID: " + currentPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
/**
|
||||
* Entfernt die Toolbar.
|
||||
*/
|
||||
public void remove() {
|
||||
app.getGuiNode().detachChild(toolbarContainer);
|
||||
app.getGuiNode().detachChild(positionText);
|
||||
super.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void escape() {
|
||||
new SettingsMenu(app).open();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package pp.monopoly.client.gui.popups;
|
||||
|
||||
import com.jme3.asset.TextureKey;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.component.IconComponent;
|
||||
|
||||
import pp.dialog.Dialog;
|
||||
import pp.monopoly.client.MonopolyApp;
|
||||
|
||||
public class LoserPopUp extends Dialog {
|
||||
|
||||
private final MonopolyApp app;
|
||||
|
||||
/**
|
||||
* Constructs a new NetworkDialog.
|
||||
*
|
||||
* @param network The NetworkSupport instance to be used for network operations.
|
||||
*/
|
||||
public LoserPopUp(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
this.app = app;
|
||||
initializeDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the dialog with input fields and connection buttons.
|
||||
*/
|
||||
private void initializeDialog() {
|
||||
Container inputContainer = new Container();
|
||||
|
||||
// Titel und Eingabefelder für Host und Port
|
||||
inputContainer.addChild(new Label("Schade, du hast leider verloren!"));
|
||||
inputContainer.addChild(new Label("Die nächste Runde wird besser!"));
|
||||
|
||||
Label imageLabel = new Label("");
|
||||
TextureKey key = new TextureKey("Pictures/MonopolyLoser.png", true);
|
||||
Texture texture = app.getAssetManager().loadTexture(key);
|
||||
IconComponent icon = new IconComponent(texture.toString()); // Icon mit Textur erstellen
|
||||
icon.setIconSize(new Vector2f(155f, 120f)); // Skalierung des Bildes
|
||||
imageLabel.setIcon(icon); // Setze das Icon im Label
|
||||
|
||||
inputContainer.addChild(imageLabel);
|
||||
|
||||
Button cancelButton = inputContainer.addChild(new Button("Spiel beenden"));
|
||||
cancelButton.addClickCommands(source -> ifTopDialog(app::closeApp));
|
||||
inputContainer.setLocalTranslation(300,500,0);
|
||||
attachChild(inputContainer);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user