Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
80df405a69
commit
e4c43354f0
@ -117,10 +117,11 @@ struct BlackjackHand: Identifiable, Equatable {
|
|||||||
// MARK: - Card Value Extension
|
// MARK: - Card Value Extension
|
||||||
|
|
||||||
extension Card {
|
extension Card {
|
||||||
/// The blackjack value of this card (Ace = 1 or 11, face cards = 10).
|
/// The blackjack value of this card for display purposes (Ace = 11, face cards = 10).
|
||||||
|
/// Note: Hand calculation handles ace flexibility (1 or 11).
|
||||||
var blackjackValue: Int {
|
var blackjackValue: Int {
|
||||||
switch rank {
|
switch rank {
|
||||||
case .ace: return 1 // Or 11, handled by hand calculation
|
case .ace: return 11 // Show as 11 for display; hand calculation handles soft/hard
|
||||||
case .two: return 2
|
case .two: return 2
|
||||||
case .three: return 3
|
case .three: return 3
|
||||||
case .four: return 4
|
case .four: return 4
|
||||||
|
|||||||
@ -18,6 +18,7 @@ struct DealerHandView: View {
|
|||||||
@ScaledMetric(relativeTo: .headline) private var labelFontSize: CGFloat = Design.Size.handLabelFontSize
|
@ScaledMetric(relativeTo: .headline) private var labelFontSize: CGFloat = Design.Size.handLabelFontSize
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
|
||||||
VStack(spacing: Design.Spacing.small) {
|
VStack(spacing: Design.Spacing.small) {
|
||||||
// Label and value
|
// Label and value
|
||||||
HStack(spacing: Design.Spacing.small) {
|
HStack(spacing: Design.Spacing.small) {
|
||||||
@ -25,17 +26,17 @@ struct DealerHandView: View {
|
|||||||
.font(.system(size: labelFontSize, weight: .bold, design: .rounded))
|
.font(.system(size: labelFontSize, weight: .bold, design: .rounded))
|
||||||
.foregroundStyle(.white)
|
.foregroundStyle(.white)
|
||||||
|
|
||||||
// Show value: always show if hole card visible, or show single card value in European mode
|
// Show value: full value when hole card visible, otherwise just the face-up card's value
|
||||||
if !hand.cards.isEmpty {
|
if !hand.cards.isEmpty {
|
||||||
if showHoleCard {
|
if showHoleCard {
|
||||||
|
// All cards visible - show total hand value
|
||||||
ValueBadge(value: hand.value, color: Color.Hand.dealer)
|
ValueBadge(value: hand.value, color: Color.Hand.dealer)
|
||||||
} else if hand.cards.count == 1 {
|
} else {
|
||||||
// European mode: show single visible card value
|
// Hole card hidden - show only the first (face-up) card's value
|
||||||
ValueBadge(value: hand.cards[0].blackjackValue, color: Color.Hand.dealer)
|
ValueBadge(value: hand.cards[0].blackjackValue, color: Color.Hand.dealer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cards
|
// Cards
|
||||||
HStack(spacing: hand.cards.isEmpty ? Design.Spacing.small : cardSpacing) {
|
HStack(spacing: hand.cards.isEmpty ? Design.Spacing.small : cardSpacing) {
|
||||||
if hand.cards.isEmpty {
|
if hand.cards.isEmpty {
|
||||||
@ -80,6 +81,20 @@ struct DealerHandView: View {
|
|||||||
}
|
}
|
||||||
.accessibilityElement(children: .ignore)
|
.accessibilityElement(children: .ignore)
|
||||||
.accessibilityLabel(dealerAccessibilityLabel)
|
.accessibilityLabel(dealerAccessibilityLabel)
|
||||||
|
.background(
|
||||||
|
GeometryReader { geo in
|
||||||
|
Color.clear
|
||||||
|
.onAppear {
|
||||||
|
print("🃏 DealerHandView SIZE: \(geo.size.width) x \(geo.size.height), cards: \(hand.cards.count), cardWidth: \(cardWidth), cardSpacing: \(cardSpacing)")
|
||||||
|
}
|
||||||
|
.onChange(of: geo.size) { oldSize, newSize in
|
||||||
|
print("🃏 DealerHandView CHANGED: \(oldSize.width)x\(oldSize.height) → \(newSize.width)x\(newSize.height), cards: \(hand.cards.count)")
|
||||||
|
}
|
||||||
|
.onChange(of: hand.cards.count) { oldCount, newCount in
|
||||||
|
print("🃏 DealerHandView CARDS: \(oldCount) → \(newCount), size: \(geo.size.width)x\(geo.size.height)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Computed Properties
|
// MARK: - Computed Properties
|
||||||
|
|||||||
@ -149,7 +149,7 @@ public enum CasinoDesign {
|
|||||||
public static let actionButtonMinWidth: CGFloat = 80
|
public static let actionButtonMinWidth: CGFloat = 80
|
||||||
|
|
||||||
/// Betting zone height.
|
/// Betting zone height.
|
||||||
public static let bettingZoneHeight: CGFloat = 80
|
public static let bettingZoneHeight: CGFloat = 70
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Icon Sizes
|
// MARK: - Icon Sizes
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user