Fix card select issue

This commit is contained in:
Felix Koppe
2024-12-06 09:48:24 +01:00
parent a6c8cc33f4
commit 26836d16cc
3 changed files with 25 additions and 6 deletions

View File

@@ -74,10 +74,11 @@ public void selectCard(BonusCard card) {
this.card = card;
GameView gameView = (GameView) app.getView();
if(card != null) {
if(card == null) {
gameView.needConfirm();
} else {
gameView.noConfirm();
gameView.needNoPower();
}
}
@@ -93,14 +94,17 @@ public void confirm() {
} else if (a != null) {
selectPiece(a);
gameView.getBoardHandler().clearSelectable();
} else if (card != null){
selectCard(card);
gameView.getGuiHandler().clearSelectableCards();
} else {
throw new RuntimeException("nothing to confirm");
if(null == card) {
selectCard(null);
} else {
selectCard(card);
gameView.getGuiHandler().clearSelectableCards();
}
}
gameView.noConfirm();
gameView.needNoPower();
}
public void selectTsk(Color color) {

View File

@@ -164,6 +164,7 @@ private void handleGame(Notification notification) {
}
} else if (notification instanceof SelectableCardsNotification n) {
guiHandler.setSelectableCards(n.getCards());
gameView.needNoPower();
} else if (notification instanceof ShieldActiveNotification n) {
boardHandler.shieldPiece(n.getPieceId());
} else if (notification instanceof ShieldSuppressedNotification n) {

View File

@@ -20,6 +20,8 @@ public class GameView extends MdgaView {
private ButtonLeft leaveButton;
private ButtonRight confirmButton;
private ButtonRight noPowerButton;
private Color ownColor = null;
private InterruptDialog interruptDialog;
@@ -36,6 +38,8 @@ public GameView(MdgaApp app) {
confirmButton = new ButtonRight(app, guiNode, () -> app.getModelSynchronize().confirm(), "Bestätigen", 1);
noPowerButton = new ButtonRight(app, guiNode, () -> app.getModelSynchronize().confirm(), "Keine Powercard", 1);
interruptDialog = new InterruptDialog(app, guiNode);
fpp = new FilterPostProcessor(app.getAssetManager());
@@ -110,6 +114,7 @@ public Color getOwnColor() {
}
public void needConfirm() {
noPowerButton.hide();
confirmButton.show();
}
@@ -117,6 +122,15 @@ public void noConfirm() {
confirmButton.hide();
}
public void needNoPower() {
confirmButton.hide();
noPowerButton.hide();
}
public void noNoPower() {
noPowerButton.show();
}
public void enterInterrupt(Color color) {
enterOverlay(Overlay.INTERRUPT);