From f2eeb6dab4498a94160bfa1ffa8409d515a4e5d4 Mon Sep 17 00:00:00 2001 From: Felix Koppe Date: Fri, 6 Dec 2024 16:27:01 +0100 Subject: [PATCH] Fix logic error regarding cardSelection --- .../pp/mdga/client/ModelSynchronizer.java | 22 +++++-------------- .../mdga/client/NotificationSynchronizer.java | 2 +- .../java/pp/mdga/client/view/GameView.java | 6 ++--- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/ModelSynchronizer.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/ModelSynchronizer.java index e9dac904..6b17eea6 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/ModelSynchronizer.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/ModelSynchronizer.java @@ -1,16 +1,8 @@ package pp.mdga.client; -import pp.mdga.client.acoustic.MdgaSound; -import pp.mdga.client.server.MdgaServer; -import pp.mdga.client.view.CeremonyView; import pp.mdga.client.view.GameView; -import pp.mdga.client.view.LobbyView; import pp.mdga.game.BonusCard; import pp.mdga.game.Color; -import pp.mdga.message.client.LobbyReadyMessage; -import pp.mdga.notification.AcquireCardNotification; -import pp.mdga.notification.DrawCardNotification; -import pp.mdga.notification.TskSelectNotification; import java.util.UUID; import java.util.logging.Level; @@ -75,10 +67,10 @@ public void selectCard(BonusCard card) { GameView gameView = (GameView) app.getView(); - if(card == null) { + if(card != null) { gameView.needConfirm(); } else { - gameView.needNoPower(); + gameView.showNoPower(); } } @@ -95,16 +87,12 @@ public void confirm() { app.getGameLogic().selectPiece(a); gameView.getBoardHandler().clearSelectable(); } else { - if(null == card) { - app.getGameLogic().selectCard(null); - } else { - app.getGameLogic().selectCard(card); - gameView.getGuiHandler().clearSelectableCards(); - } + app.getGameLogic().selectCard(card); + gameView.getGuiHandler().clearSelectableCards(); } gameView.noConfirm(); - gameView.noNoPower(); + gameView.hideNoPower(); } public void selectTsk(Color color) { diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/NotificationSynchronizer.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/NotificationSynchronizer.java index 39c8ccfd..b43d1649 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/NotificationSynchronizer.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/NotificationSynchronizer.java @@ -164,7 +164,7 @@ private void handleGame(Notification notification) { } } else if (notification instanceof SelectableCardsNotification n) { guiHandler.setSelectableCards(n.getCards()); - gameView.needNoPower(); + gameView.showNoPower(); } else if (notification instanceof ShieldActiveNotification n) { boardHandler.shieldPiece(n.getPieceId()); } else if (notification instanceof ShieldSuppressedNotification n) { diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/GameView.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/GameView.java index 7377c8e3..bd77237a 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/GameView.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/GameView.java @@ -122,13 +122,13 @@ public void noConfirm() { confirmButton.hide(); } - public void needNoPower() { + public void showNoPower() { confirmButton.hide(); noPowerButton.show(); } - public void noNoPower() { - noPowerButton.show(); + public void hideNoPower() { + noPowerButton.hide(); } public void enterInterrupt(Color color) {