Skip to content

Commit

Permalink
Merge pull request #322 from pap-24/game-focus-notification
Browse files Browse the repository at this point in the history
Game started sound notification (If page/document isn't focused)
  • Loading branch information
hsanger authored Jun 1, 2024
2 parents 350711b + a789b96 commit 47040a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Binary file added client/public/audio/sfx/join_notification.mp3
Binary file not shown.
5 changes: 5 additions & 0 deletions client/src/scripts/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@ export class Game {
// reload the page with a time stamp to try clearing cache
location.search = `t=${Date.now()}`;
}

// Sound which notifies the player that the game started if page
// is out of focus.
document.hasFocus() || this.soundManager.play('join_notification');

Check warning on line 395 in client/src/scripts/game.ts

View workflow job for this annotation

GitHub Actions / Lint

Strings must use doublequote

Check warning on line 395 in client/src/scripts/game.ts

View workflow job for this annotation

GitHub Actions / Lint

Strings must use doublequote

this.uiManager.emotes = packet.emotes;
this.uiManager.updateEmoteWheel();

Expand Down
4 changes: 3 additions & 1 deletion client/src/scripts/managers/soundManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ export class SoundManager {
puzzle_error: "audio/sfx/puzzle_error",
puzzle_solved: "audio/sfx/puzzle_solved",

bleed: "audio/sfx/bleed"
bleed: "audio/sfx/bleed",

join_notification: "audio/sfx/join_notification"
};

for (const material of Materials) {
Expand Down

0 comments on commit 47040a3

Please sign in to comment.