mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 06:06:15 +01:00
fixed some mistakes
This commit is contained in:
parent
1438ae5e4f
commit
0d8240381e
@ -24,6 +24,7 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
private final Button takeMortgageButton = new Button("Hypothek aufnehmen");
|
private final Button takeMortgageButton = new Button("Hypothek aufnehmen");
|
||||||
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");
|
||||||
|
private Geometry background;
|
||||||
|
|
||||||
public BuildingAdminMenu(MonopolyApp app) {
|
public BuildingAdminMenu(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
@ -42,7 +43,7 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
// Add content
|
// Add content
|
||||||
mainContainer.addChild(createContent());
|
mainContainer.addChild(createContent());
|
||||||
// Attach main container to GUI node
|
// Attach main container to GUI node
|
||||||
app.getGuiNode().attachChild(mainContainer);
|
attachChild(mainContainer);
|
||||||
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,
|
||||||
@ -146,29 +147,23 @@ public class BuildingAdminMenu 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, 6); // Position behind other GUI elements
|
background.setLocalTranslation(0, 0, 6); // Position behind other GUI elements
|
||||||
app.getGuiNode().attachChild(background);
|
attachChild(background);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the "Zurück" action.
|
|
||||||
*/
|
|
||||||
private void handleBack() {
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
|
||||||
close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void escape() {
|
public void escape() {
|
||||||
handleBack();
|
new SettingsMenu(app).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(float delta) {
|
public void close() {
|
||||||
// Periodic updates if necessary
|
detachChild(background);
|
||||||
|
detachChild(mainContainer);
|
||||||
|
super.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -93,7 +93,7 @@ public class PropertyOverviewMenu extends Dialog {
|
|||||||
*/
|
*/
|
||||||
private void populatePlayerProperties() {
|
private void populatePlayerProperties() {
|
||||||
// Fetch the current player
|
// Fetch the current player
|
||||||
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayers().get(0);
|
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
|
||||||
|
|
||||||
// Iterate through the player's properties
|
// Iterate through the player's properties
|
||||||
for (PropertyField property : currentPlayer.getPropertyFields()) {
|
for (PropertyField property : currentPlayer.getPropertyFields()) {
|
||||||
|
@ -220,6 +220,8 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receivedEvent(UpdatePlayerView event) {
|
public void receivedEvent(UpdatePlayerView event) {
|
||||||
|
|
||||||
|
System.out.println("Update Player View");
|
||||||
accountContainer.clearChildren();
|
accountContainer.clearChildren();
|
||||||
overviewContainer.clearChildren();
|
overviewContainer.clearChildren();
|
||||||
|
|
||||||
@ -266,4 +268,10 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
public void escape() {
|
public void escape() {
|
||||||
new SettingsMenu(app).open();
|
new SettingsMenu(app).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
receivedEvent(new UpdatePlayerView());
|
||||||
|
super.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class BuyCard extends Dialog {
|
|||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
//Generate the corresponfing field
|
//Generate the corresponfing field
|
||||||
int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();;
|
int index = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getFieldID();
|
||||||
BuildingProperty field = (BuildingProperty) new BoardManager().getFieldAtIndex(index);
|
BuildingProperty field = (BuildingProperty) new BoardManager().getFieldAtIndex(index);
|
||||||
|
|
||||||
// Create the background container
|
// Create the background container
|
||||||
|
@ -24,9 +24,6 @@ public class ConfirmTrade extends Dialog {
|
|||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
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
|
// Create the background container
|
||||||
backgroundContainer = new Container();
|
backgroundContainer = new Container();
|
||||||
|
@ -32,7 +32,7 @@ public class FoodFieldCard extends Dialog {
|
|||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
//Generate the corresponfing field
|
//Generate the corresponfing field
|
||||||
int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();
|
int index = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).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
|
||||||
|
@ -31,7 +31,7 @@ public class GateFieldCard extends Dialog {
|
|||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
//Generate the corresponfing field
|
//Generate the corresponfing field
|
||||||
int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();
|
int index = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).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
|
||||||
|
@ -37,10 +37,6 @@ public class SellHouse extends Dialog {
|
|||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
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
|
// Create the background container
|
||||||
backgroundContainer = new Container();
|
backgroundContainer = new Container();
|
||||||
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
|
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
|
||||||
@ -94,7 +90,7 @@ public class SellHouse extends Dialog {
|
|||||||
VersionedList<BuildingProperty> listModel = new VersionedList<>();
|
VersionedList<BuildingProperty> listModel = new VersionedList<>();
|
||||||
|
|
||||||
// Retrieve current player and their properties
|
// Retrieve current player and their properties
|
||||||
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayers().get(0);
|
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
|
||||||
BoardManager boardManager = app.getGameLogic().getBoardManager();
|
BoardManager boardManager = app.getGameLogic().getBoardManager();
|
||||||
|
|
||||||
List<BuildingProperty> playerProperties = boardManager.getPropertyFields(
|
List<BuildingProperty> playerProperties = boardManager.getPropertyFields(
|
||||||
|
@ -269,6 +269,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
|||||||
@Override
|
@Override
|
||||||
public void received(PlayerStatusUpdate msg) {
|
public void received(PlayerStatusUpdate msg) {
|
||||||
playerHandler = msg.getPlayerHandler();
|
playerHandler = msg.getPlayerHandler();
|
||||||
|
System.out.println("Update Player");
|
||||||
notifyListeners(new UpdatePlayerView());
|
notifyListeners(new UpdatePlayerView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +152,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
System.out.println("Properties:" +player.getProperties().toString());
|
System.out.println("Properties:" +player.getProperties().toString());
|
||||||
LOGGER.log(Level.INFO, "Player {0} bought property {1}", player.getName(), property.getName());
|
LOGGER.log(Level.INFO, "Player {0} bought property {1}", player.getName(), property.getName());
|
||||||
}
|
}
|
||||||
|
updateAllPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -173,6 +174,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
send(player, new PlayerStatusUpdate(playerHandler));
|
send(player, new PlayerStatusUpdate(playerHandler));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateAllPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -218,6 +220,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
send(player, player.rollDice());
|
send(player, player.rollDice());
|
||||||
}
|
}
|
||||||
|
updateAllPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,11 +269,15 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
if (sender != null) {
|
if (sender != null) {
|
||||||
LOGGER.log(Level.DEBUG, "Processing ViewAssetsRequest for player {0}", sender.getName());
|
LOGGER.log(Level.DEBUG, "Processing ViewAssetsRequest for player {0}", sender.getName());
|
||||||
send(sender, new ViewAssetsResponse(boardManager));
|
send(sender, new ViewAssetsResponse(boardManager));
|
||||||
|
updateAllPlayers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateAllPlayers() {
|
||||||
for (Player player : playerHandler.getPlayers()) {
|
for (Player player : playerHandler.getPlayers()) {
|
||||||
send(player, new PlayerStatusUpdate(playerHandler));
|
send(player, new PlayerStatusUpdate(playerHandler));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the board manager, which manages the game board.
|
* Retrieves the board manager, which manages the game board.
|
||||||
|
Loading…
Reference in New Issue
Block a user