Add move throw sync

This commit is contained in:
Felix Koppe
2024-12-08 23:05:30 +01:00
parent b817af29b5
commit 00902d2e6b
2 changed files with 13 additions and 2 deletions

View File

@@ -23,7 +23,11 @@ public class ModelSynchronizer {
} }
public void animationEnd() { public void animationEnd() {
app.getGameLogic().selectAnimationEnd(); if(app.getNotificationSynchronizer().waitForAnimation) {
app.getNotificationSynchronizer().waitForAnimation = false;
} else {
app.getGameLogic().selectAnimationEnd();
}
} }
public void select(UUID a, UUID b){ public void select(UUID a, UUID b){

View File

@@ -22,12 +22,18 @@ public class NotificationSynchronizer {
private static final float STANDARD_DELAY = 2.5f; private static final float STANDARD_DELAY = 2.5f;
public boolean waitForAnimation = false;
NotificationSynchronizer(MdgaApp app) { NotificationSynchronizer(MdgaApp app) {
this.app = app; this.app = app;
} }
public void update() { public void update() {
while (timer.getTimeInSeconds() >= delay) { while (timer.getTimeInSeconds() >= delay) {
if(waitForAnimation) {
return;
}
Notification n = app.getGameLogic().getNotification(); Notification n = app.getGameLogic().getNotification();
if(n == null) { if(n == null) {
@@ -161,6 +167,7 @@ private void handleGame(Notification notification) {
guiHandler.hideText(); guiHandler.hideText();
} else if (notification instanceof ThrowPieceNotification n) { } else if (notification instanceof ThrowPieceNotification n) {
boardHandler.throwPiece(n.getPieceId(), n.getThrowColor()); boardHandler.throwPiece(n.getPieceId(), n.getThrowColor());
waitForAnimation = true;
} 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) {