mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 00:06:16 +01:00
Merge remote-tracking branch 'origin/gui' into gui
# Conflicts: # Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java
This commit is contained in:
commit
fd178eee43
@ -24,6 +24,7 @@ public class BuildingAdminMenu extends Dialog {
|
||||
private final Button takeMortgageButton = new Button("Hypothek aufnehmen");
|
||||
private final Button payMortgageButton = new Button("Hypothek bezahlen");
|
||||
private final Button overviewButton = new Button("Übersicht");
|
||||
private Geometry background;
|
||||
|
||||
public BuildingAdminMenu(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
@ -42,7 +43,7 @@ public class BuildingAdminMenu extends Dialog {
|
||||
// Add content
|
||||
mainContainer.addChild(createContent());
|
||||
// Attach main container to GUI node
|
||||
app.getGuiNode().attachChild(mainContainer);
|
||||
attachChild(mainContainer);
|
||||
mainContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - mainContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + mainContainer.getPreferredSize().y) / 2,
|
||||
@ -146,29 +147,23 @@ public class BuildingAdminMenu extends Dialog {
|
||||
private void addBackgroundImage() {
|
||||
Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png");
|
||||
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");
|
||||
backgroundMaterial.setTexture("ColorMap", backgroundImage);
|
||||
background.setMaterial(backgroundMaterial);
|
||||
background.setLocalTranslation(0, 0, 6); // Position behind other GUI elements
|
||||
app.getGuiNode().attachChild(background);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the "Zurück" action.
|
||||
*/
|
||||
private void handleBack() {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
close();
|
||||
attachChild(background);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void escape() {
|
||||
handleBack();
|
||||
new SettingsMenu(app).open();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(float delta) {
|
||||
// Periodic updates if necessary
|
||||
public void close() {
|
||||
detachChild(background);
|
||||
detachChild(mainContainer);
|
||||
super.close();
|
||||
}
|
||||
}
|
@ -93,7 +93,7 @@ public class PropertyOverviewMenu extends Dialog {
|
||||
*/
|
||||
private void populatePlayerProperties() {
|
||||
// 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
|
||||
for (PropertyField property : currentPlayer.getPropertyFields()) {
|
||||
|
@ -220,6 +220,8 @@ public class Toolbar extends Dialog implements GameEventListener {
|
||||
|
||||
@Override
|
||||
public void receivedEvent(UpdatePlayerView event) {
|
||||
|
||||
System.out.println("Update Player View");
|
||||
accountContainer.clearChildren();
|
||||
overviewContainer.clearChildren();
|
||||
|
||||
@ -266,4 +268,10 @@ public class Toolbar extends Dialog implements GameEventListener {
|
||||
public void escape() {
|
||||
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;
|
||||
|
||||
//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);
|
||||
|
||||
// Create the background container
|
||||
|
@ -32,7 +32,7 @@ public class FoodFieldCard extends Dialog {
|
||||
this.app = app;
|
||||
|
||||
//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);
|
||||
|
||||
// Halbtransparentes Overlay hinzufügen
|
||||
|
@ -31,7 +31,7 @@ public class GateFieldCard extends Dialog {
|
||||
this.app = app;
|
||||
|
||||
//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);
|
||||
|
||||
// Halbtransparentes Overlay hinzufügen
|
||||
|
@ -71,7 +71,7 @@ public class SellHouse extends Dialog {
|
||||
VersionedList<BuildingProperty> listModel = new VersionedList<>();
|
||||
|
||||
// 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();
|
||||
|
||||
List<BuildingProperty> playerProperties = boardManager.getPropertyFields(
|
||||
|
@ -269,6 +269,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
@Override
|
||||
public void received(PlayerStatusUpdate msg) {
|
||||
playerHandler = msg.getPlayerHandler();
|
||||
System.out.println("Update Player");
|
||||
notifyListeners(new UpdatePlayerView());
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
System.out.println("Properties:" +player.getProperties().toString());
|
||||
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));
|
||||
}
|
||||
}
|
||||
updateAllPlayers();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,6 +220,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
if (player != null) {
|
||||
send(player, player.rollDice());
|
||||
}
|
||||
updateAllPlayers();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -266,9 +269,13 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
if (sender != null) {
|
||||
LOGGER.log(Level.DEBUG, "Processing ViewAssetsRequest for player {0}", sender.getName());
|
||||
send(sender, new ViewAssetsResponse(boardManager));
|
||||
for (Player player : playerHandler.getPlayers()) {
|
||||
send(player, new PlayerStatusUpdate(playerHandler));
|
||||
}
|
||||
updateAllPlayers();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAllPlayers() {
|
||||
for (Player player : playerHandler.getPlayers()) {
|
||||
send(player, new PlayerStatusUpdate(playerHandler));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user