mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-12-01 12:19:45 +01:00
Merge remote-tracking branch 'origin/gui' into gui
This commit is contained in:
commit
45a43d6998
@ -1,10 +1,6 @@
|
||||
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.scene.Geometry;
|
||||
import com.jme3.scene.shape.Quad;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.Label;
|
||||
@ -13,6 +9,7 @@ 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.model.fields.BoardManager;
|
||||
import pp.monopoly.model.fields.BuildingProperty;
|
||||
import pp.monopoly.notification.Sound;
|
||||
@ -25,13 +22,13 @@ public class BuyCard extends Dialog {
|
||||
private final Container buyCardContainer;
|
||||
private final Container backgroundContainer;
|
||||
|
||||
private int index = 37;
|
||||
|
||||
|
||||
public BuyCard(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
|
||||
@ -75,7 +72,7 @@ public class BuyCard extends Dialog {
|
||||
buyButton.setFontSize(32);
|
||||
buyButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
//TODO send buy property request
|
||||
app.getGameLogic().send(new BuyPropertyRequest());
|
||||
}));
|
||||
|
||||
float padding = 10; // Padding around the settingsContainer for the background
|
||||
|
@ -65,11 +65,6 @@ public class EventCard extends Dialog {
|
||||
quitButton.setFontSize(32);
|
||||
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
|
||||
backgroundContainer.setPreferredSize(eventCardContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
|
||||
|
@ -5,6 +5,7 @@ import com.jme3.material.RenderState.BlendMode;
|
||||
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.Container;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
@ -13,7 +14,9 @@ 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.model.fields.FoodField;
|
||||
import pp.monopoly.notification.Sound;
|
||||
|
||||
/**
|
||||
* FoodFieldCard erstellt die Geböudekarte vom Brandl und der Truppenküche
|
||||
@ -23,13 +26,13 @@ public class FoodFieldCard extends Dialog {
|
||||
private final Geometry overlayBackground;
|
||||
private final Container foodFieldContainer;
|
||||
private final Container backgroundContainer;
|
||||
private int index = 12;
|
||||
|
||||
public FoodFieldCard(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
this.app = app;
|
||||
|
||||
//Generate the corresponfing field
|
||||
int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();
|
||||
FoodField field = (FoodField) app.getGameLogic().getBoardManager().getFieldAtIndex(index);
|
||||
|
||||
// Halbtransparentes Overlay hinzufügen
|
||||
@ -68,22 +71,24 @@ public class FoodFieldCard extends Dialog {
|
||||
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)));
|
||||
|
||||
|
||||
//TODO eventuell diese Stelle löschen, da nur die BuyCard Kaufen und beenden hat
|
||||
|
||||
/*
|
||||
// Beenden-Button
|
||||
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
quitButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
close();
|
||||
}));
|
||||
// Kaufen-Button
|
||||
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
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
|
||||
backgroundContainer.setPreferredSize(foodFieldContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
|
||||
|
||||
// Zentriere das Menü
|
||||
foodFieldContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - foodFieldContainer.getPreferredSize().x) / 2,
|
||||
@ -127,10 +132,6 @@ public class FoodFieldCard extends Dialog {
|
||||
super.close();
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void escape() {
|
||||
new SettingsMenu(app).open();
|
||||
|
@ -5,6 +5,7 @@ import com.jme3.material.RenderState.BlendMode;
|
||||
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.Container;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
@ -12,7 +13,9 @@ 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.model.fields.GateField;
|
||||
import pp.monopoly.notification.Sound;
|
||||
|
||||
/**
|
||||
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
|
||||
@ -22,13 +25,13 @@ public class GateFieldCard extends Dialog {
|
||||
private final Geometry overlayBackground;
|
||||
private final Container gateFieldContainer;
|
||||
private final Container backgroundContainer;
|
||||
private int index = 5;
|
||||
|
||||
public GateFieldCard(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
this.app = app;
|
||||
|
||||
//Generate the corresponfing field
|
||||
int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();
|
||||
GateField field = (GateField) app.getGameLogic().getBoardManager().getFieldAtIndex(index);
|
||||
|
||||
// Halbtransparentes Overlay hinzufügen
|
||||
@ -63,16 +66,21 @@ public class GateFieldCard extends Dialog {
|
||||
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)));
|
||||
|
||||
//TODO eventuell diese Stelle löschen, da nur die BuyCard Kaufen und beenden hat
|
||||
|
||||
/*
|
||||
// Beenden-Button
|
||||
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
Button quitButton = gateFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
quitButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
close();
|
||||
}));
|
||||
// Kaufen-Button
|
||||
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
Button buyButton = gateFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
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
|
||||
backgroundContainer.setPreferredSize(gateFieldContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
@ -121,10 +129,6 @@ public class GateFieldCard extends Dialog {
|
||||
super.close();
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void escape() {
|
||||
new SettingsMenu(app).open();
|
||||
|
@ -7,30 +7,14 @@ import com.jme3.network.serializing.Serializable;
|
||||
*/
|
||||
@Serializable
|
||||
public class BuyPropertyRequest extends ClientMessage{
|
||||
private int propertyId;
|
||||
|
||||
/**
|
||||
* Default constructor for serialization purposes.
|
||||
*/
|
||||
private BuyPropertyRequest() { /* empty */ }
|
||||
|
||||
/**
|
||||
* Constructs a BuyPropertyRequest with the specified property ID.
|
||||
*
|
||||
* @param propertyId the ID of the property to buy
|
||||
*/
|
||||
public BuyPropertyRequest(int propertyId) {
|
||||
this.propertyId = propertyId;
|
||||
}
|
||||
public BuyPropertyRequest() {}
|
||||
|
||||
/**
|
||||
* Gets the ID of the property to buy.
|
||||
*
|
||||
* @return the property ID
|
||||
*/
|
||||
public int getPropertyId() {
|
||||
return propertyId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(ClientInterpreter interpreter, int from) {
|
||||
|
Loading…
Reference in New Issue
Block a user