Add move throw sync
This commit is contained in:
@@ -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){
|
||||||
@@ -94,7 +98,7 @@ public void confirm() {
|
|||||||
a = null;
|
a = null;
|
||||||
b = null;
|
b = null;
|
||||||
card = null;
|
card = null;
|
||||||
|
|
||||||
gameView.noConfirm();
|
gameView.noConfirm();
|
||||||
gameView.hideNoPower();
|
gameView.hideNoPower();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user