feat: add audio features and sounds to the game
Some checks failed
CI / Get Changed Files (pull_request) Successful in 31s
CI / Checkstyle Main (pull_request) Has been skipped
CI / Docker backend validation (pull_request) Has been skipped
CI / oxlint (pull_request) Successful in 23s
CI / prettier (pull_request) Failing after 27s
CI / eslint (pull_request) Successful in 31s
CI / test-build (pull_request) Successful in 49s
CI / Docker frontend validation (pull_request) Successful in 1m34s

This commit is contained in:
Jan-Marlon Leibl 2025-05-15 14:03:26 +02:00
commit 5809757bc9
Signed by: jleibl
GPG key ID: 300B2F906DC6F1D5
12 changed files with 133 additions and 1 deletions

View file

@ -24,6 +24,7 @@ export default class LootboxOpeningComponent {
prizeList: Reward[] = [];
animationCompleted = false;
currentUser: User | null = null;
private winSound: HTMLAudioElement;
constructor(
private route: ActivatedRoute,
@ -33,6 +34,7 @@ export default class LootboxOpeningComponent {
private authService: AuthService,
private cdr: ChangeDetectorRef
) {
this.winSound = new Audio('/sounds/win.mp3');
this.loadLootbox();
this.authService.userSubject.subscribe((user) => {
this.currentUser = user;
@ -145,6 +147,7 @@ export default class LootboxOpeningComponent {
this.animationCompleted = true;
if (this.wonReward) {
this.winSound.play();
this.userService.updateLocalBalance(this.wonReward.value);
}