Fix card select issue
This commit is contained in:
@@ -74,10 +74,11 @@ public void selectCard(BonusCard card) {
|
|||||||
this.card = card;
|
this.card = card;
|
||||||
|
|
||||||
GameView gameView = (GameView) app.getView();
|
GameView gameView = (GameView) app.getView();
|
||||||
if(card != null) {
|
|
||||||
|
if(card == null) {
|
||||||
gameView.needConfirm();
|
gameView.needConfirm();
|
||||||
} else {
|
} else {
|
||||||
gameView.noConfirm();
|
gameView.needNoPower();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,14 +94,17 @@ public void confirm() {
|
|||||||
} else if (a != null) {
|
} else if (a != null) {
|
||||||
selectPiece(a);
|
selectPiece(a);
|
||||||
gameView.getBoardHandler().clearSelectable();
|
gameView.getBoardHandler().clearSelectable();
|
||||||
} else if (card != null){
|
|
||||||
selectCard(card);
|
|
||||||
gameView.getGuiHandler().clearSelectableCards();
|
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("nothing to confirm");
|
if(null == card) {
|
||||||
|
selectCard(null);
|
||||||
|
} else {
|
||||||
|
selectCard(card);
|
||||||
|
gameView.getGuiHandler().clearSelectableCards();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gameView.noConfirm();
|
gameView.noConfirm();
|
||||||
|
gameView.needNoPower();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectTsk(Color color) {
|
public void selectTsk(Color color) {
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ private void handleGame(Notification notification) {
|
|||||||
}
|
}
|
||||||
} else if (notification instanceof SelectableCardsNotification n) {
|
} else if (notification instanceof SelectableCardsNotification n) {
|
||||||
guiHandler.setSelectableCards(n.getCards());
|
guiHandler.setSelectableCards(n.getCards());
|
||||||
|
gameView.needNoPower();
|
||||||
} else if (notification instanceof ShieldActiveNotification n) {
|
} else if (notification instanceof ShieldActiveNotification n) {
|
||||||
boardHandler.shieldPiece(n.getPieceId());
|
boardHandler.shieldPiece(n.getPieceId());
|
||||||
} else if (notification instanceof ShieldSuppressedNotification n) {
|
} else if (notification instanceof ShieldSuppressedNotification n) {
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public class GameView extends MdgaView {
|
|||||||
private ButtonLeft leaveButton;
|
private ButtonLeft leaveButton;
|
||||||
private ButtonRight confirmButton;
|
private ButtonRight confirmButton;
|
||||||
|
|
||||||
|
private ButtonRight noPowerButton;
|
||||||
|
|
||||||
private Color ownColor = null;
|
private Color ownColor = null;
|
||||||
|
|
||||||
private InterruptDialog interruptDialog;
|
private InterruptDialog interruptDialog;
|
||||||
@@ -36,6 +38,8 @@ public GameView(MdgaApp app) {
|
|||||||
|
|
||||||
confirmButton = new ButtonRight(app, guiNode, () -> app.getModelSynchronize().confirm(), "Bestätigen", 1);
|
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);
|
interruptDialog = new InterruptDialog(app, guiNode);
|
||||||
|
|
||||||
fpp = new FilterPostProcessor(app.getAssetManager());
|
fpp = new FilterPostProcessor(app.getAssetManager());
|
||||||
@@ -110,6 +114,7 @@ public Color getOwnColor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void needConfirm() {
|
public void needConfirm() {
|
||||||
|
noPowerButton.hide();
|
||||||
confirmButton.show();
|
confirmButton.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,6 +122,15 @@ public void noConfirm() {
|
|||||||
confirmButton.hide();
|
confirmButton.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void needNoPower() {
|
||||||
|
confirmButton.hide();
|
||||||
|
noPowerButton.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void noNoPower() {
|
||||||
|
noPowerButton.show();
|
||||||
|
}
|
||||||
|
|
||||||
public void enterInterrupt(Color color) {
|
public void enterInterrupt(Color color) {
|
||||||
enterOverlay(Overlay.INTERRUPT);
|
enterOverlay(Overlay.INTERRUPT);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user