Skip to content

Commit

Permalink
adding Hint again
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenil committed Apr 30, 2024
1 parent bae54d3 commit 6beb6e9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions html/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ connection.onmessage = function(event){
case "updateScoreboard":
updateScoreboard(data.scores);
break;

default:
console.log("Unknown message type:", data.type);
}
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/uta/cse3310/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ public void onMessage(WebSocket conn, String message) {
case "highlight":
handleHighlightMessage(conn , json);
break;

case "giveMehint":
sendHint(conn);
break;




Expand Down Expand Up @@ -325,6 +330,19 @@ private SubLobby findSubLobbyContainingPlayer(Player player) {
return null;
}

public void sendHint(WebSocket conn) {

for (SubLobby subLobby : ActiveGames) {

for (Player player : subLobby.getPlayers()) {
if (player.getConn().equals(conn)) {
subLobby.sendHintJson();
return;
}
}
}
System.out.println("Request for hint from a connection not in any active sub-lobby.");
}



Expand Down

0 comments on commit 6beb6e9

Please sign in to comment.