diff --git a/Projekte/.run/MdgaApp.run.xml b/Projekte/.run/MdgaApp.run.xml index 123a07af..4c60627e 100644 --- a/Projekte/.run/MdgaApp.run.xml +++ b/Projekte/.run/MdgaApp.run.xml @@ -1,6 +1,5 @@ - - \ No newline at end of file + 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 1cd3c927..0ffe9d44 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 @@ -26,37 +26,42 @@ public void addTestNotification(Notification n) { public void update() { Notification n = app.getGameLogic().getNotification(); - - if(n instanceof InfoNotification infoNotification) { - app.getView().showInfo(infoNotification.getMessage(), infoNotification.isError()); - return; - } - - if(n != null) { - switch (app.getState()) { - case MAIN: - handleMain(n); - break; - case LOBBY: - handleLobby(n); - break; - case GAME: - handleGame(n); - break; - case CEREMONY: - handleCeremony(n); - break; - case NONE: - throw new RuntimeException("no notification expected: " + n.toString()); + while (n != null) { + if(n instanceof InfoNotification infoNotification) { + app.getView().showInfo(infoNotification.getMessage(), infoNotification.isError()); + return; } + + if(n != null) { + switch (app.getState()) { + case MAIN: + handleMain(n); + break; + case LOBBY: + handleLobby(n); + break; + case GAME: + handleGame(n); + break; + case CEREMONY: + handleCeremony(n); + break; + case NONE: + throw new RuntimeException("no notification expected: " + n.getClass().getName()); + } + } + + n = app.getGameLogic().getNotification(); } } private void handleMain(Notification notification) { if (notification instanceof LobbyDialogNotification) { app.enter(MdgaState.LOBBY); + } else if (notification instanceof StartDialogNotification) { + //nothing } else { - throw new RuntimeException("notification not expected: "); + throw new RuntimeException("notification not expected in main: "+ notification.getClass().getName()); } } @@ -75,7 +80,7 @@ private void handleLobby(Notification notification) { app.enter(MdgaState.GAME); ((GameView) app.getView()).setOwnColor(n.getOwnColor()); } else { - throw new RuntimeException("notification not expected: " + notification.toString()); + throw new RuntimeException("notification not expected in lobby: " + notification.getClass().getName()); } } @@ -189,7 +194,7 @@ private void handleGame(Notification notification) { } else if (notification instanceof FinishNotification n){ guiHandler.finish(n.getColorFinished()); } else { - throw new RuntimeException("notification not expected: " + notification.toString()); + throw new RuntimeException("notification not expected in game: " + notification.getClass().getName()); } } @@ -197,7 +202,7 @@ private void handleCeremony(Notification notification) { if (notification instanceof StartDialogNotification) { app.enter(MdgaState.MAIN); } else { - throw new RuntimeException("notification not expected: " + notification.toString()); + throw new RuntimeException("notification not expected in ceremony: " + notification.getClass().getName()); } } } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/MdgaView.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/MdgaView.java index ebb105b8..e9bb1b65 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/MdgaView.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/MdgaView.java @@ -86,7 +86,7 @@ public void update(float tpf) { videoSettingsDialog.update(); audioSettingsDialog.update(); - if (null != infoLabel && infoTimer.getTimeInSeconds() > 7) { + if (null != infoLabel && infoTimer.getTimeInSeconds() > 5) { infoLabel.hide(); infoLabel = null; }