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. "45a43d6998cf164e0296ab1320bffee994007361" and "8d087a8e84b43948c638ea6c9e8678bc08c954d4" have entirely different histories.
45a43d6998
...
8d087a8e84
@ -1,11 +1,7 @@
|
|||||||
package pp.monopoly.client.gui;
|
package pp.monopoly.client.gui;
|
||||||
|
|
||||||
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;
|
||||||
import com.jme3.scene.Geometry;
|
|
||||||
import com.jme3.scene.shape.Quad;
|
|
||||||
import com.jme3.texture.Texture;
|
|
||||||
import com.simsilica.lemur.*;
|
import com.simsilica.lemur.*;
|
||||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
import com.simsilica.lemur.component.SpringGridLayout;
|
import com.simsilica.lemur.component.SpringGridLayout;
|
||||||
@ -14,10 +10,15 @@ import pp.dialog.Dialog;
|
|||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
import pp.monopoly.notification.Sound;
|
import pp.monopoly.notification.Sound;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a dialog for managing properties in the Monopoly game.
|
||||||
|
* Allows users to view properties, build, demolish, and manage mortgages.
|
||||||
|
*/
|
||||||
public class BuildingAdminMenu extends Dialog {
|
public class BuildingAdminMenu extends Dialog {
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
|
|
||||||
private final Container mainContainer;
|
private final Container mainContainer;
|
||||||
|
|
||||||
|
// Buttons
|
||||||
private final Button backButton = new Button("Zurück");
|
private final Button backButton = new Button("Zurück");
|
||||||
private final Button buildButton = new Button("Bauen");
|
private final Button buildButton = new Button("Bauen");
|
||||||
private final Button demolishButton = new Button("Abriss");
|
private final Button demolishButton = new Button("Abriss");
|
||||||
@ -25,135 +26,156 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
private final Button payMortgageButton = new Button("Hypothek bezahlen");
|
private final Button payMortgageButton = new Button("Hypothek bezahlen");
|
||||||
private final Button overviewButton = new Button("Übersicht");
|
private final Button overviewButton = new Button("Übersicht");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs the BuildingAdminMenu dialog.
|
||||||
|
*
|
||||||
|
* @param app The Monopoly application instance.
|
||||||
|
*/
|
||||||
public BuildingAdminMenu(MonopolyApp app) {
|
public BuildingAdminMenu(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
// Background Image
|
// Configure the main container
|
||||||
addBackgroundImage();
|
|
||||||
|
|
||||||
// Main container for the UI components
|
|
||||||
mainContainer = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
mainContainer = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
||||||
mainContainer.setPreferredSize(new Vector3f(800, 600, 0));
|
mainContainer.setPreferredSize(new Vector3f(app.getCamera().getWidth(), app.getCamera().getHeight(), 0));
|
||||||
mainContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(1, 1, 1, 0.7f))); // Translucent white background
|
mainContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(1, 1, 1, 0.7f))); // Translucent white background
|
||||||
|
|
||||||
// Add header
|
// Add the header
|
||||||
mainContainer.addChild(createHeaderContainer());
|
addHeader("Grundstücke Verwalten");
|
||||||
// Add content
|
|
||||||
mainContainer.addChild(createContent());
|
// Add content (Overview, Build, and Mortgage columns)
|
||||||
// Attach main container to GUI node
|
addContent();
|
||||||
|
|
||||||
|
// Attach main container to the GUI node
|
||||||
app.getGuiNode().attachChild(mainContainer);
|
app.getGuiNode().attachChild(mainContainer);
|
||||||
mainContainer.setLocalTranslation(
|
mainContainer.setLocalTranslation(0, app.getCamera().getHeight(), 7); // Full screen
|
||||||
(app.getCamera().getWidth() - mainContainer.getPreferredSize().x) / 2,
|
|
||||||
(app.getCamera().getHeight() + mainContainer.getPreferredSize().y) / 2,
|
|
||||||
7
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the header container.
|
* Adds the header section to the main container.
|
||||||
*
|
*
|
||||||
* @return The header container.
|
* @param title The title text for the header.
|
||||||
*/
|
*/
|
||||||
private Container createHeaderContainer() {
|
private void addHeader(String title) {
|
||||||
Container headerContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
Container headerContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||||
headerContainer.setPreferredSize(new Vector3f(800, 100, 0));
|
headerContainer.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 100, 0));
|
||||||
Label headerLabel = headerContainer.addChild(new Label("Grundstücke Verwalten", new ElementId("header")));
|
Label headerLabel = headerContainer.addChild(new Label(title, new ElementId("header")));
|
||||||
headerLabel.setFontSize(45);
|
headerLabel.setFontSize(40);
|
||||||
headerLabel.setInsets(new Insets3f(10, 10, 10, 10));
|
headerLabel.setInsets(new Insets3f(10, 10, 10, 10));
|
||||||
return headerContainer;
|
mainContainer.addChild(headerContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the main content container with columns for Overview, Build, and Mortgage.
|
* Adds the main content, organized into columns for Overview, Build, and Mortgage management.
|
||||||
*
|
|
||||||
* @return The content container.
|
|
||||||
*/
|
*/
|
||||||
private Container createContent() {
|
private void addContent() {
|
||||||
Container contentContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
Container contentContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||||
contentContainer.setPreferredSize(new Vector3f(800, 500, 0));
|
contentContainer.setPreferredSize(new Vector3f(app.getCamera().getWidth(), app.getCamera().getHeight() - 100, 0));
|
||||||
|
|
||||||
// Overview Column
|
// Overview Column
|
||||||
Container overviewColumn = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
Container overviewColumn = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
||||||
overviewColumn.addChild(new Label("Übersicht:")).setFontSize(30);
|
overviewColumn.addChild(new Label("Übersicht:")).setFontSize(24);
|
||||||
|
overviewColumn.addChild(createButtonContainer(overviewButton, "Übersicht", () -> {
|
||||||
|
|
||||||
overviewButton.setPreferredSize(new Vector3f(200, 50, 0));
|
|
||||||
overviewButton.addClickCommands(s -> ifTopDialog(() -> {
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
handleOverview();
|
||||||
}));
|
}));
|
||||||
overviewColumn.addChild(overviewButton);
|
overviewColumn.addChild(createButtonContainer(backButton, "Zurück", () -> {
|
||||||
|
|
||||||
// Back Button
|
|
||||||
backButton.setPreferredSize(new Vector3f(200, 50, 0));
|
|
||||||
backButton.addClickCommands(s -> ifTopDialog(() -> {
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
this.close();
|
handleBack();
|
||||||
}));
|
}));
|
||||||
overviewColumn.addChild(backButton);
|
|
||||||
|
|
||||||
contentContainer.addChild(overviewColumn);
|
|
||||||
|
|
||||||
|
|
||||||
// Build Column
|
// Build Column
|
||||||
Container buildColumn = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
Container buildColumn = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
||||||
buildColumn.addChild(new Label("Bauen:")).setFontSize(30);
|
buildColumn.addChild(new Label("Bauen:")).setFontSize(24);
|
||||||
|
buildColumn.addChild(createButtonContainer(buildButton, "Bauen", () -> {
|
||||||
buildButton.setPreferredSize(new Vector3f(200, 50, 0));
|
|
||||||
buildButton.addClickCommands(s -> ifTopDialog(() -> {
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
handleBuild();
|
||||||
}));
|
}));
|
||||||
buildColumn.addChild(buildButton);
|
buildColumn.addChild(createButtonContainer(demolishButton, "Abriss", () -> {
|
||||||
|
|
||||||
demolishButton.setPreferredSize(new Vector3f(200, 50, 0));
|
|
||||||
demolishButton.addClickCommands(s -> ifTopDialog(() -> {
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
handleDemolish();
|
||||||
}));
|
}));
|
||||||
buildColumn.addChild(demolishButton);
|
|
||||||
|
|
||||||
contentContainer.addChild(buildColumn);
|
|
||||||
|
|
||||||
|
|
||||||
// Mortgage Column
|
// Mortgage Column
|
||||||
Container mortgageColumn = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
Container mortgageColumn = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
||||||
mortgageColumn.addChild(new Label("Hypotheken:")).setFontSize(30);
|
mortgageColumn.addChild(new Label("Hypotheken:")).setFontSize(24);
|
||||||
|
mortgageColumn.addChild(createButtonContainer(takeMortgageButton, "Hypothek aufnehmen", () -> {
|
||||||
takeMortgageButton.setPreferredSize(new Vector3f(200, 50, 0));
|
|
||||||
takeMortgageButton.addClickCommands(s -> ifTopDialog(() -> {
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
handleTakeMortgage();
|
||||||
}));
|
}));
|
||||||
mortgageColumn.addChild(takeMortgageButton);
|
mortgageColumn.addChild(createButtonContainer(payMortgageButton, "Hypothek bezahlen", () -> {
|
||||||
|
|
||||||
payMortgageButton.setPreferredSize(new Vector3f(200, 50, 0));
|
|
||||||
payMortgageButton.addClickCommands(s -> ifTopDialog(() -> {
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
handlePayMortgage();
|
||||||
}));
|
}));
|
||||||
mortgageColumn.addChild(payMortgageButton);
|
|
||||||
|
|
||||||
|
|
||||||
|
// Add all columns to the content container
|
||||||
|
contentContainer.addChild(overviewColumn);
|
||||||
|
contentContainer.addChild(buildColumn);
|
||||||
contentContainer.addChild(mortgageColumn);
|
contentContainer.addChild(mortgageColumn);
|
||||||
|
|
||||||
return contentContainer;
|
|
||||||
|
mainContainer.addChild(contentContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a background image to the dialog.
|
* Creates a button within a dedicated container.
|
||||||
|
*
|
||||||
|
* @param button The button to configure.
|
||||||
|
* @param label The button label.
|
||||||
|
* @param action The action to perform when the button is clicked.
|
||||||
|
* @return The container containing the button.
|
||||||
*/
|
*/
|
||||||
private void addBackgroundImage() {
|
private Container createButtonContainer(Button button, String label, Runnable action) {
|
||||||
Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png");
|
Container buttonContainer = new Container();
|
||||||
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
|
button.setText(label);
|
||||||
Geometry background = new Geometry("Background", quad);
|
button.setPreferredSize(new Vector3f(200, 60, 0));
|
||||||
Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
button.setFontSize(30); // Larger font size for better visibility
|
||||||
backgroundMaterial.setTexture("ColorMap", backgroundImage);
|
button.addClickCommands(source -> ifTopDialog(action));
|
||||||
background.setMaterial(backgroundMaterial);
|
buttonContainer.setPreferredSize(new Vector3f(200, 60, 0)); // Ensuring container matches button size
|
||||||
background.setLocalTranslation(0, 0, 6); // Position behind other GUI elements
|
buttonContainer.addChild(button);
|
||||||
app.getGuiNode().attachChild(background);
|
return buttonContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the "Bauen" action.
|
||||||
|
*/
|
||||||
|
private void handleBuild() {
|
||||||
|
// Implement build logic
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the "Abriss" action.
|
||||||
|
*/
|
||||||
|
private void handleDemolish() {
|
||||||
|
// Implement demolish logic
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the "Hypothek aufnehmen" action.
|
||||||
|
*/
|
||||||
|
private void handleTakeMortgage() {
|
||||||
|
// Implement take mortgage logic
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the "Hypothek bezahlen" action.
|
||||||
|
*/
|
||||||
|
private void handlePayMortgage() {
|
||||||
|
// Implement pay mortgage logic
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the "Übersicht" action.
|
||||||
|
*/
|
||||||
|
private void handleOverview() {
|
||||||
|
// Implement overview logic
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the "Zurück" action.
|
* Handles the "Zurück" action.
|
||||||
*/
|
*/
|
||||||
private void handleBack() {
|
private void handleBack() {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,4 +188,4 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
public void update(float delta) {
|
public void update(float delta) {
|
||||||
// Periodic updates if necessary
|
// Periodic updates if necessary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class CreateGameMenu extends Dialog {
|
|||||||
|
|
||||||
final MonopolyApp app = network.getApp();
|
final MonopolyApp app = network.getApp();
|
||||||
|
|
||||||
int screenWidth = app.getContext().getSettings().getWidth();
|
int screenWidth = app.getContext().getSettings().getWidth();
|
||||||
int screenHeight = app.getContext().getSettings().getHeight();
|
int screenHeight = app.getContext().getSettings().getHeight();
|
||||||
|
|
||||||
// Set up the background image
|
// Set up the background image
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package pp.monopoly.client.gui.popups;
|
package pp.monopoly.client.gui.popups;
|
||||||
|
|
||||||
|
import com.jme3.material.Material;
|
||||||
|
import com.jme3.material.RenderState.BlendMode;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
|
import com.jme3.scene.Geometry;
|
||||||
|
import com.jme3.scene.shape.Quad;
|
||||||
import com.simsilica.lemur.Button;
|
import com.simsilica.lemur.Button;
|
||||||
import com.simsilica.lemur.Container;
|
import com.simsilica.lemur.Container;
|
||||||
import com.simsilica.lemur.Label;
|
import com.simsilica.lemur.Label;
|
||||||
@ -9,7 +13,6 @@ 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.client.gui.SettingsMenu;
|
import pp.monopoly.client.gui.SettingsMenu;
|
||||||
import pp.monopoly.message.client.BuyPropertyRequest;
|
|
||||||
import pp.monopoly.model.fields.BoardManager;
|
import pp.monopoly.model.fields.BoardManager;
|
||||||
import pp.monopoly.model.fields.BuildingProperty;
|
import pp.monopoly.model.fields.BuildingProperty;
|
||||||
import pp.monopoly.notification.Sound;
|
import pp.monopoly.notification.Sound;
|
||||||
@ -22,13 +25,13 @@ public class BuyCard extends Dialog {
|
|||||||
private final Container buyCardContainer;
|
private final Container buyCardContainer;
|
||||||
private final Container backgroundContainer;
|
private final Container backgroundContainer;
|
||||||
|
|
||||||
|
private int index = 37;
|
||||||
|
|
||||||
public BuyCard(MonopolyApp app) {
|
public BuyCard(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
//Generate the corresponfing field
|
//Generate the corresponfing field
|
||||||
int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();
|
|
||||||
BuildingProperty field = (BuildingProperty) new BoardManager().getFieldAtIndex(index);
|
BuildingProperty field = (BuildingProperty) new BoardManager().getFieldAtIndex(index);
|
||||||
|
|
||||||
// Create the background container
|
// Create the background container
|
||||||
@ -72,7 +75,7 @@ public class BuyCard extends Dialog {
|
|||||||
buyButton.setFontSize(32);
|
buyButton.setFontSize(32);
|
||||||
buyButton.addClickCommands(s -> ifTopDialog( () -> {
|
buyButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
app.getGameLogic().send(new BuyPropertyRequest());
|
//TODO send buy property request
|
||||||
}));
|
}));
|
||||||
|
|
||||||
float padding = 10; // Padding around the settingsContainer for the background
|
float padding = 10; // Padding around the settingsContainer for the background
|
||||||
|
@ -65,6 +65,11 @@ public class EventCard extends Dialog {
|
|||||||
quitButton.setFontSize(32);
|
quitButton.setFontSize(32);
|
||||||
quitButton.addClickCommands(source -> close());
|
quitButton.addClickCommands(source -> close());
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Kaufen-Button wird nicht mehr benötigt, prüfen ob weg kann
|
||||||
|
//Button buyButton = buyCardContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||||
|
//buyButton.setFontSize(32);
|
||||||
|
|
||||||
float padding = 10; // Padding around the settingsContainer for the background
|
float padding = 10; // Padding around the settingsContainer for the background
|
||||||
backgroundContainer.setPreferredSize(eventCardContainer.getPreferredSize().addLocal(padding, padding, 0));
|
backgroundContainer.setPreferredSize(eventCardContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import com.jme3.material.RenderState.BlendMode;
|
|||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.jme3.scene.shape.Quad;
|
import com.jme3.scene.shape.Quad;
|
||||||
import com.simsilica.lemur.Button;
|
|
||||||
import com.simsilica.lemur.Container;
|
import com.simsilica.lemur.Container;
|
||||||
import com.simsilica.lemur.Label;
|
import com.simsilica.lemur.Label;
|
||||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
@ -14,9 +13,7 @@ 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.client.gui.SettingsMenu;
|
import pp.monopoly.client.gui.SettingsMenu;
|
||||||
import pp.monopoly.message.client.BuyPropertyRequest;
|
|
||||||
import pp.monopoly.model.fields.FoodField;
|
import pp.monopoly.model.fields.FoodField;
|
||||||
import pp.monopoly.notification.Sound;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FoodFieldCard erstellt die Geböudekarte vom Brandl und der Truppenküche
|
* FoodFieldCard erstellt die Geböudekarte vom Brandl und der Truppenküche
|
||||||
@ -26,13 +23,13 @@ public class FoodFieldCard extends Dialog {
|
|||||||
private final Geometry overlayBackground;
|
private final Geometry overlayBackground;
|
||||||
private final Container foodFieldContainer;
|
private final Container foodFieldContainer;
|
||||||
private final Container backgroundContainer;
|
private final Container backgroundContainer;
|
||||||
|
private int index = 12;
|
||||||
|
|
||||||
public FoodFieldCard(MonopolyApp app) {
|
public FoodFieldCard(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
//Generate the corresponfing field
|
//Generate the corresponfing field
|
||||||
int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();
|
|
||||||
FoodField field = (FoodField) app.getGameLogic().getBoardManager().getFieldAtIndex(index);
|
FoodField field = (FoodField) app.getGameLogic().getBoardManager().getFieldAtIndex(index);
|
||||||
|
|
||||||
// Halbtransparentes Overlay hinzufügen
|
// Halbtransparentes Overlay hinzufügen
|
||||||
@ -71,24 +68,22 @@ public class FoodFieldCard extends Dialog {
|
|||||||
propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text")));
|
propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text")));
|
||||||
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
|
|
||||||
|
|
||||||
|
//TODO eventuell diese Stelle löschen, da nur die BuyCard Kaufen und beenden hat
|
||||||
|
|
||||||
|
/*
|
||||||
// Beenden-Button
|
// Beenden-Button
|
||||||
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||||
quitButton.setFontSize(32);
|
quitButton.setFontSize(32);
|
||||||
quitButton.addClickCommands(s -> ifTopDialog(() -> {
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
|
||||||
close();
|
|
||||||
}));
|
|
||||||
// Kaufen-Button
|
// Kaufen-Button
|
||||||
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||||
buyButton.setFontSize(32);
|
buyButton.setFontSize(32);
|
||||||
buyButton.addClickCommands(s -> ifTopDialog( () -> {
|
*/
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
|
||||||
app.getGameLogic().send(new BuyPropertyRequest());
|
|
||||||
}));
|
|
||||||
|
|
||||||
float padding = 10; // Padding around the settingsContainer for the background
|
float padding = 10; // Padding around the settingsContainer for the background
|
||||||
backgroundContainer.setPreferredSize(foodFieldContainer.getPreferredSize().addLocal(padding, padding, 0));
|
backgroundContainer.setPreferredSize(foodFieldContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||||
|
|
||||||
|
|
||||||
// Zentriere das Menü
|
// Zentriere das Menü
|
||||||
foodFieldContainer.setLocalTranslation(
|
foodFieldContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - foodFieldContainer.getPreferredSize().x) / 2,
|
(app.getCamera().getWidth() - foodFieldContainer.getPreferredSize().x) / 2,
|
||||||
@ -132,6 +127,10 @@ public class FoodFieldCard extends Dialog {
|
|||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIndex(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void escape() {
|
public void escape() {
|
||||||
new SettingsMenu(app).open();
|
new SettingsMenu(app).open();
|
||||||
|
@ -5,7 +5,6 @@ import com.jme3.material.RenderState.BlendMode;
|
|||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.jme3.scene.shape.Quad;
|
import com.jme3.scene.shape.Quad;
|
||||||
import com.simsilica.lemur.Button;
|
|
||||||
import com.simsilica.lemur.Container;
|
import com.simsilica.lemur.Container;
|
||||||
import com.simsilica.lemur.Label;
|
import com.simsilica.lemur.Label;
|
||||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
@ -13,9 +12,7 @@ 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.client.gui.SettingsMenu;
|
import pp.monopoly.client.gui.SettingsMenu;
|
||||||
import pp.monopoly.message.client.BuyPropertyRequest;
|
|
||||||
import pp.monopoly.model.fields.GateField;
|
import pp.monopoly.model.fields.GateField;
|
||||||
import pp.monopoly.notification.Sound;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
|
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
|
||||||
@ -25,13 +22,13 @@ public class GateFieldCard extends Dialog {
|
|||||||
private final Geometry overlayBackground;
|
private final Geometry overlayBackground;
|
||||||
private final Container gateFieldContainer;
|
private final Container gateFieldContainer;
|
||||||
private final Container backgroundContainer;
|
private final Container backgroundContainer;
|
||||||
|
private int index = 5;
|
||||||
|
|
||||||
public GateFieldCard(MonopolyApp app) {
|
public GateFieldCard(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
//Generate the corresponfing field
|
//Generate the corresponfing field
|
||||||
int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();
|
|
||||||
GateField field = (GateField) app.getGameLogic().getBoardManager().getFieldAtIndex(index);
|
GateField field = (GateField) app.getGameLogic().getBoardManager().getFieldAtIndex(index);
|
||||||
|
|
||||||
// Halbtransparentes Overlay hinzufügen
|
// Halbtransparentes Overlay hinzufügen
|
||||||
@ -66,21 +63,16 @@ public class GateFieldCard extends Dialog {
|
|||||||
propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text")));
|
propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text")));
|
||||||
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
|
|
||||||
|
//TODO eventuell diese Stelle löschen, da nur die BuyCard Kaufen und beenden hat
|
||||||
|
|
||||||
|
/*
|
||||||
// Beenden-Button
|
// Beenden-Button
|
||||||
Button quitButton = gateFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||||
quitButton.setFontSize(32);
|
quitButton.setFontSize(32);
|
||||||
quitButton.addClickCommands(s -> ifTopDialog(() -> {
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
|
||||||
close();
|
|
||||||
}));
|
|
||||||
// Kaufen-Button
|
// Kaufen-Button
|
||||||
Button buyButton = gateFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||||
buyButton.setFontSize(32);
|
buyButton.setFontSize(32);
|
||||||
buyButton.addClickCommands(s -> ifTopDialog(() -> {
|
*/
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
|
||||||
app.getGameLogic().send(new BuyPropertyRequest());
|
|
||||||
close();
|
|
||||||
}));
|
|
||||||
|
|
||||||
float padding = 10; // Padding around the settingsContainer for the background
|
float padding = 10; // Padding around the settingsContainer for the background
|
||||||
backgroundContainer.setPreferredSize(gateFieldContainer.getPreferredSize().addLocal(padding, padding, 0));
|
backgroundContainer.setPreferredSize(gateFieldContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||||
@ -129,6 +121,10 @@ public class GateFieldCard extends Dialog {
|
|||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIndex(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void escape() {
|
public void escape() {
|
||||||
new SettingsMenu(app).open();
|
new SettingsMenu(app).open();
|
||||||
|
@ -7,14 +7,30 @@ import com.jme3.network.serializing.Serializable;
|
|||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
public class BuyPropertyRequest extends ClientMessage{
|
public class BuyPropertyRequest extends ClientMessage{
|
||||||
|
private int propertyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor for serialization purposes.
|
||||||
|
*/
|
||||||
|
private BuyPropertyRequest() { /* empty */ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a BuyPropertyRequest with the specified property ID.
|
* Constructs a BuyPropertyRequest with the specified property ID.
|
||||||
*
|
*
|
||||||
* @param propertyId the ID of the property to buy
|
* @param propertyId the ID of the property to buy
|
||||||
*/
|
*/
|
||||||
public BuyPropertyRequest() {}
|
public BuyPropertyRequest(int propertyId) {
|
||||||
|
this.propertyId = propertyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ID of the property to buy.
|
||||||
|
*
|
||||||
|
* @return the property ID
|
||||||
|
*/
|
||||||
|
public int getPropertyId() {
|
||||||
|
return propertyId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(ClientInterpreter interpreter, int from) {
|
public void accept(ClientInterpreter interpreter, int from) {
|
||||||
|
Loading…
Reference in New Issue
Block a user