diff --git a/Client/find-all-words/resources/config.properties b/Client/find-all-words/resources/config.properties index e04bbcf..0474889 100644 --- a/Client/find-all-words/resources/config.properties +++ b/Client/find-all-words/resources/config.properties @@ -1,5 +1,5 @@ #saved -#Sun Feb 06 01:51:54 CET 2022 +#Sun Feb 06 16:11:35 CET 2022 defaultPort=1313 about=TODO serverAddress=127.0.0.1 diff --git a/Client/find-all-words/src/put/poznan/GUI/VoteView.java b/Client/find-all-words/src/put/poznan/GUI/VoteView.java index 9efff51..c72bf52 100644 --- a/Client/find-all-words/src/put/poznan/GUI/VoteView.java +++ b/Client/find-all-words/src/put/poznan/GUI/VoteView.java @@ -121,6 +121,8 @@ public void onShowAction() { this.updatePlayersList.execute(); this.updateTimer = new UpdateTimer(); this.updateTimer.execute(); + this.vote.setEnabled(true); + this.timer = new GameTimer(); System.out.println("List of nicks updater started"); } @@ -158,7 +160,7 @@ protected Void doInBackground() { lock.wait(); publish(ConnectionHandler.responseTable.get("timerStart").response); } catch (InterruptedException e) { - e.printStackTrace(); + //e.printStackTrace(); return null; } } @@ -168,7 +170,7 @@ protected Void doInBackground() { lock.wait(); publish(ConnectionHandler.responseTable.get("gameStart").response); } catch (InterruptedException e) { - e.printStackTrace(); + //e.printStackTrace(); return null; } } @@ -181,14 +183,14 @@ protected void process(List chunks) { String response = chunks.get(chunks.size() - 1); List split; split = new ArrayList<>(List.of(response.split("_"))); - - if ("NOTIFICATION_START_COUNTDOWN_10".equals(response)) { + System.out.println(split); + if (response.matches("NOTIFICATION_START_COUNTDOWN_[0-9]+")) { vote.setEnabled(false); timerLabel.setText("Game starts in..."); timer.setTime(Integer.parseInt(split.get(3)) * 1000); timer.start(); } - if ("NOTIFICATION_START_GAME".equals(response)) { + if (response.matches("NOTIFICATION_START_GAME_[0-9]+")) { timer.stop(); fakeButton.doClick(); @@ -210,7 +212,7 @@ protected Void doInBackground() { lock.wait(); publish(ConnectionHandler.responseTable.get("playersVotes").response); } catch (InterruptedException e) { - e.printStackTrace(); + //e.printStackTrace(); return null; } } diff --git a/Client/find-all-words/src/put/poznan/networking/ConnectionHandler.java b/Client/find-all-words/src/put/poznan/networking/ConnectionHandler.java index 485f14f..3b04e4b 100644 --- a/Client/find-all-words/src/put/poznan/networking/ConnectionHandler.java +++ b/Client/find-all-words/src/put/poznan/networking/ConnectionHandler.java @@ -47,7 +47,7 @@ public static void initializeTable() { responseTable.put("playersVotes", new Triplet("NOTIFICATION_LOBBY_PLAYERS_[0-9]_.{4,}_[0-1]_.*")); responseTable.put("selfVote", new Triplet("RESPONSE_LOBBY_VOTE_.{7}_[0-1]")); responseTable.put("timerStart", new Triplet("NOTIFICATION_START_COUNTDOWN_10")); - responseTable.put("gameStart", new Triplet("NOTIFICATION_START_GAME")); + responseTable.put("gameStart", new Triplet("NOTIFICATION_START_GAME_[0-9]+")); } @SuppressWarnings("unused") public static String getMessage() {