Improve interrupt
This commit is contained in:
@@ -89,6 +89,7 @@ private void handleGame(Notification notification) {
|
|||||||
|
|
||||||
if (notification instanceof AcquireCardNotification n) {
|
if (notification instanceof AcquireCardNotification n) {
|
||||||
guiHandler.addCardOwn(n.getBonusCard());
|
guiHandler.addCardOwn(n.getBonusCard());
|
||||||
|
app.getAcousticHandler().playSound(MdgaSound.BONUS);
|
||||||
} else if (notification instanceof ActivePlayerNotification n) {
|
} else if (notification instanceof ActivePlayerNotification n) {
|
||||||
gameView.getGuiHandler().setActivePlayer(n.getColor());
|
gameView.getGuiHandler().setActivePlayer(n.getColor());
|
||||||
boardHandler.showDice(n.getColor());
|
boardHandler.showDice(n.getColor());
|
||||||
@@ -127,8 +128,8 @@ private void handleGame(Notification notification) {
|
|||||||
} else if (notification instanceof HomeMoveNotification home) {
|
} else if (notification instanceof HomeMoveNotification home) {
|
||||||
boardHandler.movePieceHomeAnim(home.getPieceId(), home.getHomeIndex());
|
boardHandler.movePieceHomeAnim(home.getPieceId(), home.getHomeIndex());
|
||||||
guiHandler.hideText();
|
guiHandler.hideText();
|
||||||
} else if (notification instanceof InterruptNotification) {
|
} else if (notification instanceof InterruptNotification notification1) {
|
||||||
gameView.enterInterrupt();
|
gameView.enterInterrupt(notification1.getColor());
|
||||||
} else if (notification instanceof MovePieceNotification n) {
|
} else if (notification instanceof MovePieceNotification n) {
|
||||||
if(n.isMoveStart()) {
|
if(n.isMoveStart()) {
|
||||||
//StartMove
|
//StartMove
|
||||||
|
|||||||
@@ -8,18 +8,21 @@
|
|||||||
import pp.mdga.client.button.LabelButton;
|
import pp.mdga.client.button.LabelButton;
|
||||||
import pp.mdga.client.button.MenuButton;
|
import pp.mdga.client.button.MenuButton;
|
||||||
import pp.mdga.client.view.MdgaView;
|
import pp.mdga.client.view.MdgaView;
|
||||||
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
public class InterruptDialog extends Dialog {
|
public class InterruptDialog extends Dialog {
|
||||||
private ButtonRight forceButton;
|
private ButtonRight forceButton;
|
||||||
|
|
||||||
private LabelButton label;
|
private LabelButton label;
|
||||||
|
|
||||||
|
private String text = "";
|
||||||
|
|
||||||
public InterruptDialog(MdgaApp app, Node node) {
|
public InterruptDialog(MdgaApp app, Node node) {
|
||||||
super(app, node);
|
super(app, node);
|
||||||
|
|
||||||
forceButton = new ButtonRight(app, node, () -> app.getModelSynchronize().force(), "Erzwingen", 1);
|
forceButton = new ButtonRight(app, node, () -> app.getModelSynchronize().force(), "Erzwingen", 1);
|
||||||
|
|
||||||
label = new LabelButton(app, node, "Warte auf Spieler...", new Vector2f(5.5f * 1.5f, 2), new Vector2f(0.5f, 0f), false);
|
label = new LabelButton(app, node, "Warte auf " + text + "...", new Vector2f(5.5f * 1.5f, 2), new Vector2f(0.5f, 0f), false);
|
||||||
|
|
||||||
float offset = 2.8f;
|
float offset = 2.8f;
|
||||||
|
|
||||||
@@ -40,4 +43,21 @@ protected void onHide() {
|
|||||||
forceButton.hide();
|
forceButton.hide();
|
||||||
label.hide();
|
label.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setColor(Color color) {
|
||||||
|
switch (color) {
|
||||||
|
case AIRFORCE:
|
||||||
|
text = "Luftwaffe";
|
||||||
|
break;
|
||||||
|
case ARMY:
|
||||||
|
text = "Heer";
|
||||||
|
break;
|
||||||
|
case NAVY:
|
||||||
|
text = "Marine";
|
||||||
|
break;
|
||||||
|
case CYBER:
|
||||||
|
text = "CIR";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public void noConfirm() {
|
|||||||
confirmButton.hide();
|
confirmButton.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enterInterrupt() {
|
public void enterInterrupt(Color color) {
|
||||||
enterOverlay(Overlay.INTERRUPT);
|
enterOverlay(Overlay.INTERRUPT);
|
||||||
|
|
||||||
guiNode.detachChild(guiHandlerNode);
|
guiNode.detachChild(guiHandlerNode);
|
||||||
@@ -124,6 +124,7 @@ public void enterInterrupt() {
|
|||||||
|
|
||||||
app.getInputSynchronize().setClickAllowed(false);
|
app.getInputSynchronize().setClickAllowed(false);
|
||||||
|
|
||||||
|
interruptDialog.setColor(color);
|
||||||
interruptDialog.show();
|
interruptDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +136,8 @@ public void leaveInterrupt() {
|
|||||||
|
|
||||||
app.getInputSynchronize().setClickAllowed(true);
|
app.getInputSynchronize().setClickAllowed(true);
|
||||||
|
|
||||||
|
app.getAcousticHandler().playSound(MdgaSound.START);
|
||||||
|
|
||||||
interruptDialog.hide();
|
interruptDialog.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user