mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-08-03 23:30:26 +02:00
show test world when GameStart message is recieved
This commit is contained in:
@@ -199,10 +199,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
@Override
|
||||
public void received(BuyPropertyResponse msg) {
|
||||
if (msg.isSuccessful()) {
|
||||
setInfoText("You successfully bought " + msg.getPropertyName() + "!");
|
||||
|
||||
playSound(Sound.MONEY_LOST);
|
||||
} else {
|
||||
setInfoText("Unable to buy " + msg.getPropertyName() + ". Reason: " + msg.getReason());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
*/
|
||||
@Override
|
||||
public void received(DiceResult msg) {
|
||||
setInfoText("You rolled a " + msg.calcTotal() + "!");
|
||||
|
||||
//Set the dice images
|
||||
playSound(Sound.DICE_ROLL);
|
||||
}
|
||||
@@ -225,7 +225,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
*/
|
||||
@Override
|
||||
public void received(EventDrawCard msg) {
|
||||
setInfoText("Event card drawn: " + msg.getCardDescription());
|
||||
|
||||
// Kartenlogik
|
||||
playSound(Sound.EVENT_CARD);
|
||||
}
|
||||
@@ -238,11 +238,11 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
@Override
|
||||
public void received(GameOver msg) {
|
||||
if (msg.isWinner()) {
|
||||
setInfoText("Congratulations! You have won the game!");
|
||||
|
||||
//Winner popup
|
||||
playSound(Sound.WINNER);
|
||||
} else {
|
||||
setInfoText("Game over. Better luck next time!");
|
||||
|
||||
// Looser popup
|
||||
playSound(Sound.LOSER);
|
||||
}
|
||||
@@ -256,8 +256,8 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
@Override
|
||||
public void received(GameStart msg) {
|
||||
players = msg.getPlayers();
|
||||
setInfoText("The game has started! Good luck!");
|
||||
setState(new WaitForTurnState(this));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,10 +268,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
@Override
|
||||
public void received(JailEvent msg) {
|
||||
if (msg.isGoingToJail()) {
|
||||
setInfoText("You are sent to jail!");
|
||||
|
||||
playSound(Sound.GULAG);
|
||||
} else {
|
||||
setInfoText("You are out of jail!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
@Override
|
||||
public void received(PlayerStatusUpdate msg) {
|
||||
|
||||
setInfoText("Player " + msg.getPlayerName() + " status updated: " + msg.getStatus());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -293,7 +293,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
*/
|
||||
@Override
|
||||
public void received(TimeOutWarning msg) {
|
||||
setInfoText("Warning! Time is running out. You have " + msg.getRemainingTime() + " seconds left.");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,7 +303,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
*/
|
||||
@Override
|
||||
public void received(ViewAssetsResponse msg) {
|
||||
setInfoText("Your current assets are being displayed.");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,10 +314,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
@Override
|
||||
public void received(TradeReply msg) {
|
||||
if (msg.getTradeHandler().getStatus()) {
|
||||
setInfoText("Trade accepted by " + msg.getTradeHandler().getReceiver().getName() + ".");
|
||||
|
||||
playSound(Sound.TRADE_ACCEPTED);
|
||||
} else {
|
||||
setInfoText("Trade rejected by " + msg.getTradeHandler().getReceiver().getName() + ".");
|
||||
|
||||
playSound(Sound.TRADE_REJECTED);
|
||||
}
|
||||
}
|
||||
@@ -329,7 +329,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
*/
|
||||
@Override
|
||||
public void received(TradeRequest msg) {
|
||||
setInfoText("Trade offer received from " + msg.getTradeHandler().getSender().getName());
|
||||
|
||||
// playSound(Sound.TRADE_REQUEST); no sound effect
|
||||
// notifyListeners();
|
||||
}
|
||||
@@ -341,7 +341,8 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
*/
|
||||
@Override
|
||||
public void received(NextPlayerTurn msg) {
|
||||
setInfoText("It's your turn!");
|
||||
|
||||
System.out.println("Du bsit am zug message empfangen");
|
||||
setState(new ActiveState(this));
|
||||
}
|
||||
}
|
||||
|
@@ -175,7 +175,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
LOGGER.log(Level.DEBUG, "Ending turn for player {0}", player.getName());
|
||||
Player next = playerHandler.nextPlayer();
|
||||
next.setActive();
|
||||
send(next, new NextPlayerTurn(next));
|
||||
send(next, new NextPlayerTurn());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
send(p, new GameStart(playerHandler.getPlayers()));
|
||||
}
|
||||
playerHandler.randomOrder();
|
||||
send(playerHandler.getPlayerAtIndex(0), new NextPlayerTurn(playerHandler.getPlayerAtIndex(0)));
|
||||
send(playerHandler.getPlayerAtIndex(0), new NextPlayerTurn());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,20 +2,13 @@ package pp.monopoly.message.server;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
|
||||
@Serializable
|
||||
public class NextPlayerTurn extends ServerMessage{
|
||||
|
||||
private Player player;
|
||||
|
||||
/**
|
||||
* Default constructor for serialization purposes.
|
||||
*/
|
||||
private NextPlayerTurn() { /* empty */ }
|
||||
|
||||
public NextPlayerTurn(Player player) {
|
||||
this.player = player;
|
||||
public NextPlayerTurn() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -28,9 +21,4 @@ public class NextPlayerTurn extends ServerMessage{
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,8 +3,11 @@ package pp.monopoly.model.fields;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
|
||||
@Serializable
|
||||
public class BuildingProperty extends PropertyField {
|
||||
|
||||
private int houses;
|
||||
@@ -17,6 +20,12 @@ public class BuildingProperty extends PropertyField {
|
||||
private final int rentFactor4 = 55;
|
||||
private final int rentFactorHotel = 70;
|
||||
|
||||
private BuildingProperty(){
|
||||
super("", 0, 0, 0);
|
||||
this.housePrice = 0;
|
||||
this.color = null;
|
||||
}
|
||||
|
||||
BuildingProperty(String name, int id, int price, int rent, int housePrice, FieldColor color) {
|
||||
super(name, id, price, rent);
|
||||
this.housePrice = housePrice;
|
||||
|
@@ -1,11 +1,18 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
|
||||
@Serializable
|
||||
public class EventField extends Field{
|
||||
|
||||
public EventField(String name, int id) {
|
||||
private EventField() {
|
||||
super("", 0);
|
||||
}
|
||||
|
||||
EventField(String name, int id) {
|
||||
super(name, id);
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,19 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
|
||||
abstract class Field {
|
||||
@Serializable
|
||||
public abstract class Field {
|
||||
protected final String name;
|
||||
protected final int id;
|
||||
|
||||
private Field() {
|
||||
this.name = "";
|
||||
this.id = 0;
|
||||
}
|
||||
|
||||
protected Field(String name, int id) {
|
||||
this.name = name;
|
||||
this.id= id;
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
/**
|
||||
* Enum representing eight distinct colors for properties in the game.
|
||||
*/
|
||||
// @Serializable
|
||||
public enum FieldColor {
|
||||
BROWN(new ColorRGBA(148 / 255f, 86 / 255f, 57 / 255f, 1)),
|
||||
GREEN(new ColorRGBA(30 / 255f, 179 / 255f, 90 / 255f, 1)),
|
||||
@@ -17,6 +19,10 @@ public enum FieldColor {
|
||||
|
||||
private final ColorRGBA color;
|
||||
|
||||
private FieldColor() {
|
||||
this.color = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a FieldColor with the specified ColorRGBA value.
|
||||
*
|
||||
|
@@ -1,11 +1,19 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
|
||||
@Serializable
|
||||
public class FineField extends Field{
|
||||
|
||||
private final int fine;
|
||||
|
||||
private FineField() {
|
||||
super("", 0);
|
||||
this.fine = 0;
|
||||
}
|
||||
|
||||
FineField(String name, int id, int fine) {
|
||||
super(name, id);
|
||||
this.fine = fine;
|
||||
|
@@ -1,10 +1,17 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
|
||||
@Serializable
|
||||
public class FoodField extends PropertyField {
|
||||
|
||||
public FoodField(String name, int id) {
|
||||
private FoodField() {
|
||||
super("", 0, 0, 0);
|
||||
}
|
||||
|
||||
FoodField(String name, int id) {
|
||||
super(name, id, 1500,0);
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,15 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
@Serializable
|
||||
public class GateField extends PropertyField{
|
||||
|
||||
private GateField() {
|
||||
super("", 0, 0, 0);
|
||||
}
|
||||
|
||||
GateField(String name, int id) {
|
||||
super(name, id, 2000, 25);
|
||||
}
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
@Serializable
|
||||
public class GoField extends Field{
|
||||
|
||||
public GoField() {
|
||||
GoField() {
|
||||
super("Monatsgehalt", 0);
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,9 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
@Serializable
|
||||
public class GulagField extends Field{
|
||||
|
||||
private int bailCost = 500;
|
||||
|
@@ -1,11 +1,14 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
|
||||
/**
|
||||
* Represents an abstract property field in the Monopoly game.
|
||||
* Contains attributes related to ownership, price, rent, and mortgage status.
|
||||
*/
|
||||
@Serializable
|
||||
public abstract class PropertyField extends Field {
|
||||
|
||||
private final int price;
|
||||
@@ -13,6 +16,12 @@ public abstract class PropertyField extends Field {
|
||||
private Player owner;
|
||||
private boolean mortgaged = false;
|
||||
|
||||
private PropertyField() {
|
||||
super("", 0);
|
||||
this.price = 0;
|
||||
this.rent = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a PropertyField with the specified name, ID, price, and rent.
|
||||
*
|
||||
|
@@ -1,7 +1,10 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
|
||||
@Serializable
|
||||
public class TestStreckeField extends Field{
|
||||
private int money;
|
||||
|
||||
|
@@ -1,10 +1,13 @@
|
||||
package pp.monopoly.model.fields;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
|
||||
@Serializable
|
||||
public class WacheField extends Field{
|
||||
|
||||
public WacheField() {
|
||||
WacheField() {
|
||||
super("Wache", 30);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user