Fix card select issue
This commit is contained in:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user