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. "fa20a6cb2ae534aa94dda219fdcae457ceccdcd1" and "411f7ea25b59d152ee9a6d50ef30f3d2793f3618" have entirely different histories.
fa20a6cb2a
...
411f7ea25b
@ -163,6 +163,14 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
app.getGuiNode().attachChild(background);
|
app.getGuiNode().attachChild(background);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the "Zurück" action.
|
||||||
|
*/
|
||||||
|
private void handleBack() {
|
||||||
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
app.getGuiNode().detachChild(mainContainer);
|
app.getGuiNode().detachChild(mainContainer);
|
||||||
@ -172,7 +180,7 @@ public class BuildingAdminMenu extends Dialog {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void escape() {
|
public void escape() {
|
||||||
new SettingsMenu(app).open();
|
handleBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,6 +84,24 @@ public class TradeMenu extends Dialog {
|
|||||||
mainContent.addChild(createMiddleSection());
|
mainContent.addChild(createMiddleSection());
|
||||||
mainContent.addChild(createTradeColumn("Wähle Zielobjekt:", false));
|
mainContent.addChild(createTradeColumn("Wähle Zielobjekt:", false));
|
||||||
|
|
||||||
|
Container buttons = mainContent.addChild(new Container(new SpringGridLayout()));
|
||||||
|
Button cancel = new Button("Abbrechen");
|
||||||
|
cancel.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
|
close();
|
||||||
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
}));
|
||||||
|
|
||||||
|
Button trade = new Button("Handeln");
|
||||||
|
trade.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
|
setTrades();
|
||||||
|
app.getGameLogic().send(new TradeOffer(tradeHandler));
|
||||||
|
close();
|
||||||
|
}));
|
||||||
|
|
||||||
|
buttons.addChild(cancel);
|
||||||
|
buttons.addChild(trade);
|
||||||
|
|
||||||
return mainContent;
|
return mainContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,30 +196,16 @@ public class TradeMenu extends Dialog {
|
|||||||
leftSelectionsField = middleSection.addChild(new TextField(""));
|
leftSelectionsField = middleSection.addChild(new TextField(""));
|
||||||
leftSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
|
leftSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
|
||||||
|
|
||||||
Container buttons = middleSection.addChild(new Container(new SpringGridLayout()));
|
Label arrows = middleSection.addChild(new Label("⇅"));
|
||||||
Button cancel = new Button("Abbrechen");
|
arrows.setFontSize(40);
|
||||||
cancel.addClickCommands(s -> ifTopDialog(() -> {
|
|
||||||
close();
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
|
||||||
}));
|
|
||||||
|
|
||||||
Button trade = new Button("Handeln");
|
rightSelectionsField = middleSection.addChild(new TextField(""));
|
||||||
trade.addClickCommands(s -> ifTopDialog(() -> {
|
rightSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
|
||||||
setTrades();
|
|
||||||
app.getGameLogic().send(new TradeOffer(tradeHandler));
|
|
||||||
close();
|
|
||||||
}));
|
|
||||||
|
|
||||||
buttons.addChild(cancel);
|
|
||||||
buttons.addChild(trade);
|
|
||||||
|
|
||||||
Label middleLabelBottom = middleSection.addChild(new Label("Gebäude: Währung: Sonderkarten:"));
|
Label middleLabelBottom = middleSection.addChild(new Label("Gebäude: Währung: Sonderkarten:"));
|
||||||
middleLabelBottom.setFontSize(24);
|
middleLabelBottom.setFontSize(24);
|
||||||
middleLabelBottom.setInsets(new Insets3f(5, 5, 5, 5));
|
middleLabelBottom.setInsets(new Insets3f(5, 5, 5, 5));
|
||||||
|
|
||||||
rightSelectionsField = middleSection.addChild(new TextField(""));
|
|
||||||
rightSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
|
|
||||||
return middleSection;
|
return middleSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +217,6 @@ public class TradeMenu extends Dialog {
|
|||||||
private void styleTextField(TextField textField) {
|
private void styleTextField(TextField textField) {
|
||||||
textField.setInsets(new Insets3f(5, 10, 5, 10));
|
textField.setInsets(new Insets3f(5, 10, 5, 10));
|
||||||
textField.setBackground(new QuadBackgroundComponent(ColorRGBA.Black));
|
textField.setBackground(new QuadBackgroundComponent(ColorRGBA.Black));
|
||||||
textField.setPreferredSize(new Vector3f(300, 30, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assignSelectors(Selector<String> buildingSelector, Selector<String> specialCardSelector, TextField currencyInput, boolean isLeft) {
|
private void assignSelectors(Selector<String> buildingSelector, Selector<String> specialCardSelector, TextField currencyInput, boolean isLeft) {
|
||||||
@ -278,6 +281,7 @@ public class TradeMenu extends Dialog {
|
|||||||
}
|
}
|
||||||
for (String property : leftselBuildings) {
|
for (String property : leftselBuildings) {
|
||||||
buildingText.append(property);
|
buildingText.append(property);
|
||||||
|
buildingText.append(", ");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rightselBuildings.contains(building.getSelectedItem())) {
|
if (rightselBuildings.contains(building.getSelectedItem())) {
|
||||||
@ -287,6 +291,7 @@ public class TradeMenu extends Dialog {
|
|||||||
}
|
}
|
||||||
for (String property : rightselBuildings) {
|
for (String property : rightselBuildings) {
|
||||||
buildingText.append(property);
|
buildingText.append(property);
|
||||||
|
buildingText.append(", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,6 @@ public class BuyHouse extends Dialog {
|
|||||||
AlterProperty msg = new AlterProperty("BuyHouse");
|
AlterProperty msg = new AlterProperty("BuyHouse");
|
||||||
msg.setProperties(selectedProperties.stream().map(p -> app.getGameLogic().getBoardManager().getFieldByName(p).getId()).map(p -> (Integer) p).collect(Collectors.toSet()));
|
msg.setProperties(selectedProperties.stream().map(p -> app.getGameLogic().getBoardManager().getFieldByName(p).getId()).map(p -> (Integer) p).collect(Collectors.toSet()));
|
||||||
app.getGameLogic().send(msg);
|
app.getGameLogic().send(msg);
|
||||||
close();
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Center the popup
|
// Center the popup
|
||||||
@ -161,7 +160,6 @@ public class BuyHouse extends Dialog {
|
|||||||
return boardManager.getPropertyFields(self.getProperties()).stream()
|
return boardManager.getPropertyFields(self.getProperties()).stream()
|
||||||
.filter(property -> property instanceof BuildingProperty)
|
.filter(property -> property instanceof BuildingProperty)
|
||||||
.map(property -> (BuildingProperty) property)
|
.map(property -> (BuildingProperty) property)
|
||||||
.filter(property -> app.getGameLogic().getBoardManager().canBuild(property))
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,6 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
private void updateAllPlayers() {
|
private void updateAllPlayers() {
|
||||||
for (Player player : playerHandler.getPlayers()) {
|
for (Player player : playerHandler.getPlayers()) {
|
||||||
send(player, new PlayerStatusUpdate(playerHandler));
|
send(player, new PlayerStatusUpdate(playerHandler));
|
||||||
send(player, new ViewAssetsResponse(boardManager));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,14 +418,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
playerHandler.getPlayerById(from).useJailCard();
|
playerHandler.getPlayerById(from).useJailCard();
|
||||||
} else if (msg.getA().equals("PayJail")) {
|
} else if (msg.getA().equals("PayJail")) {
|
||||||
playerHandler.getPlayerById(from).payBail();
|
playerHandler.getPlayerById(from).payBail();
|
||||||
} else if(msg.getA().equals("hack")) {
|
|
||||||
System.out.println("HAck ausgeführt");
|
|
||||||
for (BuildingProperty bp : boardManager.getPropertyFields( List.of(1,3)).stream().filter(p -> p instanceof BuildingProperty).map(p -> (BuildingProperty) p).collect(Collectors.toList())) {
|
|
||||||
bp.setOwner(playerHandler.getPlayerById(0));
|
|
||||||
playerHandler.getPlayerById(0).addProperty(bp.getId());
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
updateAllPlayers();
|
updateAllPlayers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ public class BoardManager {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// Check if the player owns all properties in the color group
|
// Check if the player owns all properties in the color group
|
||||||
if (!groupProperties.stream().allMatch(bp -> bp.getOwner() != null && bp.getOwner().getId() == field.getOwner().getId())) {
|
if (!groupProperties.stream().allMatch(bp -> bp.getOwner() != null && bp.getOwner().equals(field.getOwner()))) {
|
||||||
return false; // The player must own all properties in the color group
|
return false; // The player must own all properties in the color group
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package pp.monopoly.model.fields;
|
package pp.monopoly.model.fields;
|
||||||
|
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
|
import com.jme3.network.serializing.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum representing eight distinct colors for properties in the game.
|
* Enum representing eight distinct colors for properties in the game.
|
||||||
*/
|
*/
|
||||||
|
// @Serializable
|
||||||
public enum FieldColor {
|
public enum FieldColor {
|
||||||
BROWN(new ColorRGBA(148 / 255f, 86 / 255f, 57 / 255f, 1)),
|
BROWN(new ColorRGBA(148 / 255f, 86 / 255f, 57 / 255f, 1)),
|
||||||
GREEN(new ColorRGBA(30 / 255f, 179 / 255f, 90 / 255f, 1)),
|
GREEN(new ColorRGBA(30 / 255f, 179 / 255f, 90 / 255f, 1)),
|
||||||
|
Loading…
Reference in New Issue
Block a user