Fix uuid serialisation error

This commit is contained in:
Felix Koppe
2024-12-09 01:47:32 +01:00
parent 8e2fc6c1a1
commit 8af3b2d9d4
3 changed files with 15 additions and 3 deletions

View File

@@ -66,6 +66,8 @@ public class MdgaApp extends SimpleApplication {
private ServerConnection networkConnection;
public static final int DEBUG_MULTIPLIER = 0;
public MdgaApp() {
networkConnection = new NetworkSupport(this);
this.clientGameLogic = new ClientGameLogic(networkConnection);

View File

@@ -7,6 +7,7 @@
import pp.mdga.client.view.CeremonyView;
import pp.mdga.client.view.GameView;
import pp.mdga.client.view.LobbyView;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
import pp.mdga.notification.*;
@@ -171,6 +172,12 @@ private void handleGame(Notification notification) {
} else if (notification instanceof NoShieldNotification n) {
boardHandler.unshieldPiece(n.getPieceId());
} else if (notification instanceof PlayCardNotification n) {
if(n.getCard() == BonusCard.TURBO) {
guiHandler.turbo();
app.getModelSynchronize().animationEnd();
return;
}
if(n.getColor() == ownColor) guiHandler.playCardOwn(n.getCard());
else guiHandler.playCardEnemy(n.getColor(), n.getCard());
} else if (notification instanceof PlayerInGameNotification n) {
@@ -203,7 +210,7 @@ private void handleGame(Notification notification) {
boardHandler.swapPieceAnim(n.getFirstPiece(), n.getSecondPiece());
guiHandler.swap();
} else if (notification instanceof WaitMoveNotification) {
//TODO ???
//nothing
} else if (notification instanceof SelectableMoveNotification n) {
boardHandler.outlineMove(n.getPieces(), n.getMoveIndices(), n.getHomeMoves());
modelSynchronizer.setSwap(false);
@@ -214,7 +221,7 @@ private void handleGame(Notification notification) {
boardHandler.outlineShield(n.getPieces());
modelSynchronizer.setSwap(false);
} else if (notification instanceof TurboActiveNotification){
guiHandler.turbo();
//nothing
} else if (notification instanceof FinishNotification n){
guiHandler.finish(n.getColorFinished());
} else {

View File

@@ -21,6 +21,9 @@ public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException
public void writeObject(ByteBuffer buffer, Object object) throws IOException
{
UUID uuid = (UUID) object;
buffer.put(uuid.toString().getBytes());
if(uuid != null) {
buffer.put(uuid.toString().getBytes());
}
}
}