send player ready

This commit is contained in:
Johannes Schmelz
2024-11-24 22:06:19 +01:00
parent dcf10e0819
commit 422faec281
10 changed files with 91 additions and 14 deletions

View File

@@ -144,6 +144,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
LOGGER.log(Level.ERROR, "trying to send {0} with sender==null", msg); //NON-NLS
} else {
clientSender.send(msg);
System.out.println("Message gesendet");
}
}

View File

@@ -1,11 +1,19 @@
package pp.monopoly.message.client;
import com.jme3.network.serializing.Serializable;
/**
* Represents a request from a player to buy a property.
*/
@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.
*

View File

@@ -1,9 +1,18 @@
package pp.monopoly.message.client;
import com.jme3.network.serializing.Serializable;
/**
* Represents a message indicating the player wants to end their turn.
*/
@Serializable
public class EndTurn extends ClientMessage{
/**
* Default constructor for serialization purposes.
*/
public EndTurn() { /* empty */ }
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,13 +1,21 @@
package pp.monopoly.message.client;
import com.jme3.network.serializing.Serializable;
/**
* Represents a message indicating the player is ready to play.
*/
@Serializable
public class PlayerReady extends ClientMessage {
private final boolean isReady;
private final String name;
private final String figure;
private final int startMoney;
private boolean isReady;
private String name;
private String figure;
private int startMoney;
/**
* Default constructor for serialization purposes.
*/
private PlayerReady() { /* empty */ }
/**
* Constructs a PlayerReady message.

View File

@@ -1,9 +1,18 @@
package pp.monopoly.message.client;
import com.jme3.network.serializing.Serializable;
/**
* Represents a message requesting to roll the dice.
*/
@Serializable
public class RollDice extends ClientMessage{
/**
* Default constructor for serialization purposes.
*/
private RollDice() { /* empty */ }
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,14 +1,21 @@
package pp.monopoly.message.client;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.model.TradeHandler;
/**
* Represents a trade Request message from one player to another.
*/
@Serializable
public class TradeOffer extends ClientMessage{
private int receiverId;
private TradeHandler tradehandler;
/**
* Default constructor for serialization purposes.
*/
private TradeOffer() { /* empty */ }
/**
* Constructs a TradeOffer with the specified details.

View File

@@ -1,14 +1,22 @@
package pp.monopoly.message.client;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.model.TradeHandler;
/**
* Represents a response to a trade offer.
*/
@Serializable
public class TradeResponse extends ClientMessage{
private int initiatorId;
private TradeHandler tradeHandler;
/**
* Default constructor for serialization purposes.
*/
private TradeResponse() { /* empty */ }
/**
* Constructs a TradeResponse with the specified response details.
*

View File

@@ -1,13 +1,21 @@
package pp.monopoly.message.client;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player;
/**
* Represents a request from a player to view their assets.
*/
@Serializable
public class ViewAssetsRequest extends ClientMessage{
private final Player player;
private Player player;
/**
* Default constructor for serialization purposes.
*/
private ViewAssetsRequest() { /* empty */ }
public ViewAssetsRequest(Player player) {
this.player = player;