Fix serialisation issue

This commit is contained in:
Felix Koppe
2024-12-03 15:38:13 +01:00
parent a0a088a0c4
commit db50986f3f
4 changed files with 12 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
import com.jme3.network.*; import com.jme3.network.*;
import com.jme3.network.serializing.Serializer; import com.jme3.network.serializing.Serializer;
import com.jme3.network.serializing.serializers.EnumSerializer;
import pp.mdga.Resources; import pp.mdga.Resources;
import pp.mdga.game.*; import pp.mdga.game.*;
import pp.mdga.message.client.*; import pp.mdga.message.client.*;
@@ -145,6 +146,10 @@ private void initializeSerializables() {
Serializer.registerClass(StartNode.class); Serializer.registerClass(StartNode.class);
Serializer.registerClass(PlayerData.class); Serializer.registerClass(PlayerData.class);
Serializer.registerClass(HomeNode.class); Serializer.registerClass(HomeNode.class);
Serializer.registerClass(Color.class, new EnumSerializer());
Serializer.registerClass(PieceState.class, new EnumSerializer());
Serializer.registerClass(ShieldState.class, new EnumSerializer());
} }
private void registerListeners() { private void registerListeners() {

View File

@@ -1,9 +1,12 @@
package pp.mdga.game; package pp.mdga.game;
import com.jme3.network.serializing.Serializable;
/** /**
* This enumeration will be used to show the four different TSK which can be picked from a player. * This enumeration will be used to show the four different TSK which can be picked from a player.
* In Addition, the NONE color will be used to show a none color. * In Addition, the NONE color will be used to show a none color.
*/ */
@Serializable
public enum Color { public enum Color {
/** /**
* Represents the air force color. * Represents the air force color.

View File

@@ -10,7 +10,7 @@ public class Node {
protected Piece occupant; protected Piece occupant;
public Node(){ public Node(){
occupant = new Piece(Color.AIRFORCE, PieceState.WAITING);
} }
/** /**

View File

@@ -1,8 +1,11 @@
package pp.mdga.game; package pp.mdga.game;
import com.jme3.network.serializing.Serializable;
/** /**
* Represents the state of a piece. * Represents the state of a piece.
*/ */
@Serializable
public enum PieceState { public enum PieceState {
/** /**
* The piece is active. * The piece is active.