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() {
app.getGameLogic().selectAnimationEnd();
if(app.getNotificationSynchronizer().waitForAnimation) {
app.getNotificationSynchronizer().waitForAnimation = false;
} else {
app.getGameLogic().selectAnimationEnd();
}
}
public void select(UUID a, UUID b){
@@ -94,7 +98,7 @@ public void confirm() {
a = null;
b = null;
card = null;
gameView.noConfirm();
gameView.hideNoPower();
}

View File

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