From 40c402ae36fce63ec3bf8285934bd5dc5689023e Mon Sep 17 00:00:00 2001 From: Jan-Marlon Leibl Date: Wed, 2 Apr 2025 13:03:04 +0200 Subject: [PATCH] feat: add hand value display to dealer and player hands --- .../components/dealer-hand/dealer-hand.component.ts | 13 ++++++++++++- .../components/player-hand/player-hand.component.ts | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/feature/game/blackjack/components/dealer-hand/dealer-hand.component.ts b/frontend/src/app/feature/game/blackjack/components/dealer-hand/dealer-hand.component.ts index b1a40ed..3674d63 100644 --- a/frontend/src/app/feature/game/blackjack/components/dealer-hand/dealer-hand.component.ts +++ b/frontend/src/app/feature/game/blackjack/components/dealer-hand/dealer-hand.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } f import { CommonModule } from '@angular/common'; import { Card } from '@blackjack/models/blackjack.model'; import { PlayingCardComponent } from '../playing-card/playing-card.component'; +import { GameControlsService } from '@blackjack/services/game-controls.service'; @Component({ selector: 'app-dealer-hand', @@ -9,7 +10,15 @@ import { PlayingCardComponent } from '../playing-card/playing-card.component'; imports: [CommonModule, PlayingCardComponent], template: `
-

Dealer's Karten

+
+

Dealer's Karten

+
+
Punkte:
+
+ {{ gameControlsService.calculateHandValue(cards) }} +
+
+
@if (cards.length > 0) { @@ -38,6 +47,8 @@ export class DealerHandComponent implements OnChanges { private lastCardCount = 0; + constructor(protected gameControlsService: GameControlsService) {} + ngOnChanges(changes: SimpleChanges): void { if (changes['cards']) { this.updateCardsWithState(); diff --git a/frontend/src/app/feature/game/blackjack/components/player-hand/player-hand.component.ts b/frontend/src/app/feature/game/blackjack/components/player-hand/player-hand.component.ts index b921a3c..bca976c 100644 --- a/frontend/src/app/feature/game/blackjack/components/player-hand/player-hand.component.ts +++ b/frontend/src/app/feature/game/blackjack/components/player-hand/player-hand.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } f import { CommonModule } from '@angular/common'; import { PlayingCardComponent } from '../playing-card/playing-card.component'; import { Card } from '@blackjack/models/blackjack.model'; +import { GameControlsService } from '@blackjack/services/game-controls.service'; @Component({ selector: 'app-player-hand', @@ -9,7 +10,15 @@ import { Card } from '@blackjack/models/blackjack.model'; imports: [CommonModule, PlayingCardComponent], template: `
-

Deine Karten

+
+

Deine Karten

+
+
Punkte:
+
+ {{ gameControlsService.calculateHandValue(cards) }} +
+
+