Fix uuid serialisation error
This commit is contained in:
@@ -66,6 +66,8 @@ public class MdgaApp extends SimpleApplication {
|
|||||||
|
|
||||||
private ServerConnection networkConnection;
|
private ServerConnection networkConnection;
|
||||||
|
|
||||||
|
public static final int DEBUG_MULTIPLIER = 0;
|
||||||
|
|
||||||
public MdgaApp() {
|
public MdgaApp() {
|
||||||
networkConnection = new NetworkSupport(this);
|
networkConnection = new NetworkSupport(this);
|
||||||
this.clientGameLogic = new ClientGameLogic(networkConnection);
|
this.clientGameLogic = new ClientGameLogic(networkConnection);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
import pp.mdga.client.view.CeremonyView;
|
import pp.mdga.client.view.CeremonyView;
|
||||||
import pp.mdga.client.view.GameView;
|
import pp.mdga.client.view.GameView;
|
||||||
import pp.mdga.client.view.LobbyView;
|
import pp.mdga.client.view.LobbyView;
|
||||||
|
import pp.mdga.game.BonusCard;
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
import pp.mdga.notification.*;
|
import pp.mdga.notification.*;
|
||||||
|
|
||||||
@@ -171,6 +172,12 @@ private void handleGame(Notification notification) {
|
|||||||
} else if (notification instanceof NoShieldNotification n) {
|
} else if (notification instanceof NoShieldNotification n) {
|
||||||
boardHandler.unshieldPiece(n.getPieceId());
|
boardHandler.unshieldPiece(n.getPieceId());
|
||||||
} else if (notification instanceof PlayCardNotification n) {
|
} 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());
|
if(n.getColor() == ownColor) guiHandler.playCardOwn(n.getCard());
|
||||||
else guiHandler.playCardEnemy(n.getColor(), n.getCard());
|
else guiHandler.playCardEnemy(n.getColor(), n.getCard());
|
||||||
} else if (notification instanceof PlayerInGameNotification n) {
|
} else if (notification instanceof PlayerInGameNotification n) {
|
||||||
@@ -203,7 +210,7 @@ private void handleGame(Notification notification) {
|
|||||||
boardHandler.swapPieceAnim(n.getFirstPiece(), n.getSecondPiece());
|
boardHandler.swapPieceAnim(n.getFirstPiece(), n.getSecondPiece());
|
||||||
guiHandler.swap();
|
guiHandler.swap();
|
||||||
} else if (notification instanceof WaitMoveNotification) {
|
} else if (notification instanceof WaitMoveNotification) {
|
||||||
//TODO ???
|
//nothing
|
||||||
} else if (notification instanceof SelectableMoveNotification n) {
|
} else if (notification instanceof SelectableMoveNotification n) {
|
||||||
boardHandler.outlineMove(n.getPieces(), n.getMoveIndices(), n.getHomeMoves());
|
boardHandler.outlineMove(n.getPieces(), n.getMoveIndices(), n.getHomeMoves());
|
||||||
modelSynchronizer.setSwap(false);
|
modelSynchronizer.setSwap(false);
|
||||||
@@ -214,7 +221,7 @@ private void handleGame(Notification notification) {
|
|||||||
boardHandler.outlineShield(n.getPieces());
|
boardHandler.outlineShield(n.getPieces());
|
||||||
modelSynchronizer.setSwap(false);
|
modelSynchronizer.setSwap(false);
|
||||||
} else if (notification instanceof TurboActiveNotification){
|
} else if (notification instanceof TurboActiveNotification){
|
||||||
guiHandler.turbo();
|
//nothing
|
||||||
} else if (notification instanceof FinishNotification n){
|
} else if (notification instanceof FinishNotification n){
|
||||||
guiHandler.finish(n.getColorFinished());
|
guiHandler.finish(n.getColorFinished());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException
|
|||||||
public void writeObject(ByteBuffer buffer, Object object) throws IOException
|
public void writeObject(ByteBuffer buffer, Object object) throws IOException
|
||||||
{
|
{
|
||||||
UUID uuid = (UUID) object;
|
UUID uuid = (UUID) object;
|
||||||
buffer.put(uuid.toString().getBytes());
|
|
||||||
|
if(uuid != null) {
|
||||||
|
buffer.put(uuid.toString().getBytes());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user