Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>

This commit is contained in:
Matt Bruce 2026-01-24 16:06:36 -06:00
parent 833841dcdd
commit b08acb9012
6 changed files with 161 additions and 74 deletions

View File

@ -4443,10 +4443,6 @@
} }
} }
}, },
"TAP" : {
"comment" : "Text displayed as an overlay on the card during the interactive reveal state, instructing the user to tap.",
"isCommentAutoGenerated" : true
},
"Tap Deal to start the round" : { "Tap Deal to start the round" : {
"comment" : "Instructional text for new players.", "comment" : "Instructional text for new players.",
"extractionState" : "stale", "extractionState" : "stale",

View File

@ -312,6 +312,7 @@ struct GameTableView: View, SherpaDelegate {
bettedOnPlayer: state.bettedOnPlayer, bettedOnPlayer: state.bettedOnPlayer,
isDealing: isDealing, isDealing: isDealing,
screenSize: screenSize, screenSize: screenSize,
totalBetAmount: state.totalBetAmount,
onReveal: { state.revealCurrentCard() }, onReveal: { state.revealCurrentCard() },
onUpdateProgress: { state.updateRevealProgress($0) } onUpdateProgress: { state.updateRevealProgress($0) }
) )
@ -321,28 +322,28 @@ struct GameTableView: View, SherpaDelegate {
Spacer(minLength: 0) Spacer(minLength: 0)
// Betting table // Betting table - completely hidden during dealing
BettingTableView( if !isDealing {
gameState: state, BettingTableView(
selectedChip: selectedChip gameState: state,
) selectedChip: selectedChip
.frame(maxWidth: maxContentWidth)
.padding(.horizontal, Design.Spacing.medium)
.opacity(isDealing ? (state.isWaitingForReveal ? 0.1 : 0.3) : 1.0)
.blur(radius: isDealing ? (state.isWaitingForReveal ? 3 : 1.5) : 0)
.scaleEffect(isDealing && state.isWaitingForReveal ? 0.95 : 1.0)
.debugBorder(showDebugBorders, color: .blue, label: "BetTable")
// Betting hint (static, below table, above chips)
if let hintInfo = state.currentHintInfo {
BettingHintView(
hint: hintInfo.text,
secondaryInfo: hintInfo.secondaryText,
style: hintInfo.style
) )
.frame(maxWidth: maxContentWidth)
.padding(.horizontal, Design.Spacing.medium)
.transition(.opacity) .transition(.opacity)
.padding(.vertical, Design.Spacing.small) .debugBorder(showDebugBorders, color: .blue, label: "BetTable")
.debugBorder(showDebugBorders, color: .purple, label: "Hint")
// Betting hint (static, below table, above chips)
if let hintInfo = state.currentHintInfo {
BettingHintView(
hint: hintInfo.text,
secondaryInfo: hintInfo.secondaryText,
style: hintInfo.style
)
.transition(.opacity)
.padding(.vertical, Design.Spacing.small)
.debugBorder(showDebugBorders, color: .purple, label: "Hint")
}
} }
Spacer(minLength: Design.Spacing.xSmall) Spacer(minLength: Design.Spacing.xSmall)
@ -424,6 +425,7 @@ struct GameTableView: View, SherpaDelegate {
bettedOnPlayer: state.bettedOnPlayer, bettedOnPlayer: state.bettedOnPlayer,
isDealing: isDealing, isDealing: isDealing,
screenSize: screenSize, screenSize: screenSize,
totalBetAmount: state.totalBetAmount,
onReveal: { state.revealCurrentCard() }, onReveal: { state.revealCurrentCard() },
onUpdateProgress: { state.updateRevealProgress($0) } onUpdateProgress: { state.updateRevealProgress($0) }
) )
@ -446,28 +448,28 @@ struct GameTableView: View, SherpaDelegate {
.debugBorder(showDebugBorders, color: .yellow, label: "Spacer3") .debugBorder(showDebugBorders, color: .yellow, label: "Spacer3")
} }
// Betting table // Betting table - completely hidden during dealing
BettingTableView( if !isDealing {
gameState: state, BettingTableView(
selectedChip: selectedChip gameState: state,
) selectedChip: selectedChip
.frame(maxWidth: isLargeScreen ? maxContentWidth : .infinity)
.padding(.horizontal, Design.Spacing.medium)
.opacity(isDealing ? (state.isWaitingForReveal ? 0.1 : 0.3) : 1.0)
.blur(radius: isDealing ? (state.isWaitingForReveal ? 3 : 1.5) : 0)
.scaleEffect(isDealing && state.isWaitingForReveal ? 0.95 : 1.0)
.debugBorder(showDebugBorders, color: .blue, label: "BetTable")
// Betting hint (static, below table, above chips)
if let hintInfo = state.currentHintInfo {
BettingHintView(
hint: hintInfo.text,
secondaryInfo: hintInfo.secondaryText,
style: hintInfo.style
) )
.frame(maxWidth: isLargeScreen ? maxContentWidth : .infinity)
.padding(.horizontal, Design.Spacing.medium)
.transition(.opacity) .transition(.opacity)
.padding(.vertical, Design.Spacing.small) .debugBorder(showDebugBorders, color: .blue, label: "BetTable")
.debugBorder(showDebugBorders, color: .purple, label: "Hint")
// Betting hint (static, below table, above chips)
if let hintInfo = state.currentHintInfo {
BettingHintView(
hint: hintInfo.text,
secondaryInfo: hintInfo.secondaryText,
style: hintInfo.style
)
.transition(.opacity)
.padding(.vertical, Design.Spacing.small)
.debugBorder(showDebugBorders, color: .purple, label: "Hint")
}
} }
// Chip selector - only shown during betting phase // Chip selector - only shown during betting phase

View File

@ -34,6 +34,8 @@ struct CardsDisplayArea: View {
let isDealing: Bool let isDealing: Bool
/// Full screen size for calculating card width in dealing mode. /// Full screen size for calculating card width in dealing mode.
let screenSize: CGSize let screenSize: CGSize
/// Total bet amount to display below the bottom hand during dealing.
let totalBetAmount: Int
let onReveal: () -> Void let onReveal: () -> Void
let onUpdateProgress: (Double) -> Void let onUpdateProgress: (Double) -> Void
@ -164,6 +166,9 @@ struct CardsDisplayArea: View {
playerHandSection(width: handSectionWidth) playerHandSection(width: handSectionWidth)
.matchedGeometryEffect(id: "player", in: animation) .matchedGeometryEffect(id: "player", in: animation)
// Bet amount below the bottom hand
betAmountDisplay
} else { } else {
playerHandSection(width: handSectionWidth) playerHandSection(width: handSectionWidth)
.matchedGeometryEffect(id: "player", in: animation) .matchedGeometryEffect(id: "player", in: animation)
@ -173,6 +178,9 @@ struct CardsDisplayArea: View {
bankerHandSection(width: handSectionWidth) bankerHandSection(width: handSectionWidth)
.matchedGeometryEffect(id: "banker", in: animation) .matchedGeometryEffect(id: "banker", in: animation)
// Bet amount below the bottom hand
betAmountDisplay
} }
} }
} else { } else {
@ -199,18 +207,39 @@ struct CardsDisplayArea: View {
} }
} }
) )
// Only show background in betting phase (horizontal layout)
.background( .background(
RoundedRectangle(cornerRadius: Design.CornerRadius.xLarge) Group {
.fill(Color.black.opacity(isWaitingForReveal ? 0.05 : Design.Opacity.quarter)) if !isDealing {
.accessibilityHidden(true) RoundedRectangle(cornerRadius: Design.CornerRadius.xLarge)
.fill(Color.black.opacity(Design.Opacity.quarter))
.accessibilityHidden(true)
}
}
) )
.debugBorder(showDebugBorders, color: .mint, label: "HandsContainer") .debugBorder(showDebugBorders, color: .mint, label: "HandsContainer")
.animation(.spring(duration: 0.6, bounce: 0.2), value: isDealing) .animation(.easeOut(duration: 0.5), value: isDealing)
.animation(.spring(duration: 0.5, bounce: 0.15), value: playerOnBottom) .animation(.easeOut(duration: 0.4), value: playerOnBottom)
} }
// MARK: - Private Views // MARK: - Private Views
/// Bet amount display shown below the bottom hand during dealing.
@ViewBuilder
private var betAmountDisplay: some View {
if totalBetAmount > 0 {
HStack(spacing: Design.Spacing.xSmall) {
Image(systemName: "dollarsign.circle.fill")
.font(.system(size: Design.BaseFontSize.xLarge))
.foregroundStyle(.yellow)
Text("\(totalBetAmount)")
.font(.system(size: Design.BaseFontSize.medium, weight: .bold, design: .rounded))
.foregroundStyle(.yellow)
}
.padding(.top, Design.Spacing.medium)
}
}
private func playerHandSection(width: CGFloat) -> some View { private func playerHandSection(width: CGFloat) -> some View {
// Calculate value from face-up cards // Calculate value from face-up cards
let visibleValue: Int = { let visibleValue: Int = {
@ -336,6 +365,7 @@ struct CardsDisplayArea: View {
bettedOnPlayer: nil, bettedOnPlayer: nil,
isDealing: false, isDealing: false,
screenSize: CGSize(width: 400, height: 800), screenSize: CGSize(width: 400, height: 800),
totalBetAmount: 0,
onReveal: {}, onReveal: {},
onUpdateProgress: { _ in } onUpdateProgress: { _ in }
) )
@ -370,6 +400,7 @@ struct CardsDisplayArea: View {
bettedOnPlayer: true, bettedOnPlayer: true,
isDealing: true, isDealing: true,
screenSize: CGSize(width: 400, height: 800), screenSize: CGSize(width: 400, height: 800),
totalBetAmount: 150,
onReveal: {}, onReveal: {},
onUpdateProgress: { _ in } onUpdateProgress: { _ in }
) )
@ -406,6 +437,7 @@ struct CardsDisplayArea: View {
bettedOnPlayer: false, bettedOnPlayer: false,
isDealing: true, isDealing: true,
screenSize: CGSize(width: 400, height: 800), screenSize: CGSize(width: 400, height: 800),
totalBetAmount: 250,
onReveal: {}, onReveal: {},
onUpdateProgress: { _ in } onUpdateProgress: { _ in }
) )

View File

@ -148,6 +148,7 @@ struct CompactHandView: View {
} }
.frame(height: cardHeight) .frame(height: cardHeight)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.padding(.vertical, isWinner ? Design.Spacing.small : 0)
.background(winnerBorder) .background(winnerBorder)
.overlay(alignment: .bottom) { .overlay(alignment: .bottom) {
winBadge winBadge
@ -184,6 +185,7 @@ struct CompactHandView: View {
revealStyle: revealStyle, revealStyle: revealStyle,
isWaiting: isWaitingForReveal && currentRevealIndex == revealIndex, isWaiting: isWaitingForReveal && currentRevealIndex == revealIndex,
progress: currentRevealIndex == revealIndex ? revealProgress : 0.0, progress: currentRevealIndex == revealIndex ? revealProgress : 0.0,
isBottomHand: isBottom,
onReveal: onReveal, onReveal: onReveal,
onUpdateProgress: onUpdateProgress onUpdateProgress: onUpdateProgress
) )

View File

@ -15,9 +15,19 @@ struct InteractiveCardView: View {
let revealStyle: RevealStyle let revealStyle: RevealStyle
let isWaiting: Bool let isWaiting: Bool
let progress: Double let progress: Double
/// Whether this card is in the bottom (Home) hand - used for glow effect
let isBottomHand: Bool
let onReveal: () -> Void let onReveal: () -> Void
let onUpdateProgress: (Double) -> Void let onUpdateProgress: (Double) -> Void
/// Whether to show the glowing animation around this card
private var showGlow: Bool {
isWaiting && !isFaceUp && isBottomHand && revealStyle != .auto
}
/// Animation state for the pulsing glow
@State private var glowPulse = false
var body: some View { var body: some View {
ZStack { ZStack {
if revealStyle == .squeeze && !isFaceUp && isWaiting { if revealStyle == .squeeze && !isFaceUp && isWaiting {
@ -26,14 +36,11 @@ struct InteractiveCardView: View {
width: cardWidth, width: cardWidth,
onReveal: onReveal onReveal: onReveal
) )
.modifier(GlowModifier(isActive: showGlow, glowPulse: glowPulse, cardWidth: cardWidth))
} else { } else {
// Standard CardView (handles its own flip animation) // Standard CardView (handles its own flip animation)
CardView(card: card, isFaceUp: isFaceUp, cardWidth: cardWidth) CardView(card: card, isFaceUp: isFaceUp, cardWidth: cardWidth)
.overlay { .modifier(GlowModifier(isActive: showGlow, glowPulse: glowPulse, cardWidth: cardWidth))
if !isFaceUp && isWaiting && revealStyle == .tap {
revealInstructionOverlay(text: String(localized: "TAP"))
}
}
.onTapGesture { .onTapGesture {
if !isFaceUp && isWaiting && revealStyle == .tap { if !isFaceUp && isWaiting && revealStyle == .tap {
onReveal() onReveal()
@ -41,25 +48,68 @@ struct InteractiveCardView: View {
} }
} }
} }
} .onAppear {
if showGlow {
private func revealInstructionOverlay(text: String) -> some View { glowPulse = true
Text(text) }
.font(.system(size: Design.BaseFontSize.small, weight: .black, design: .rounded)) }
.foregroundStyle(.white) .onChange(of: showGlow) { _, newValue in
.padding(.horizontal, Design.Spacing.small) glowPulse = newValue
.padding(.vertical, Design.Spacing.xxSmall) }
.background( }
Capsule() }
.fill(Color.black.opacity(Design.Opacity.heavy))
.overlay( // MARK: - Glow Modifier
Capsule()
.strokeBorder(.white.opacity(Design.Opacity.medium), lineWidth: 1) /// A view modifier that adds a pulsing glow effect around a card.
) private struct GlowModifier: ViewModifier {
) let isActive: Bool
.scaleEffect(isWaiting ? 1.0 : 0.8) let glowPulse: Bool
.opacity(isWaiting ? 1.0 : 0) let cardWidth: CGFloat
.animation(.interactiveSpring().repeatForever(), value: isWaiting)
.allowsHitTesting(false) /// Corner radius matching CasinoKit's CardView
private var cornerRadius: CGFloat {
cardWidth * 0.08
}
func body(content: Content) -> some View {
if isActive {
content
.overlay {
// Glow effect using multiple stroke layers
ZStack {
// Outer glow strokes (largest to smallest for layered glow)
RoundedRectangle(cornerRadius: cornerRadius)
.stroke(Color.orange.opacity(glowPulse ? 0.6 : 0.2), lineWidth: glowPulse ? 20 : 10)
.blur(radius: 10)
RoundedRectangle(cornerRadius: cornerRadius)
.stroke(Color.yellow.opacity(glowPulse ? 0.8 : 0.3), lineWidth: glowPulse ? 12 : 6)
.blur(radius: 6)
RoundedRectangle(cornerRadius: cornerRadius)
.stroke(Color.yellow.opacity(glowPulse ? 1.0 : 0.5), lineWidth: glowPulse ? 6 : 3)
.blur(radius: 3)
// Bright animated border (sharp, on top)
RoundedRectangle(cornerRadius: cornerRadius)
.strokeBorder(
LinearGradient(
colors: [.yellow, .white, .yellow],
startPoint: .topLeading,
endPoint: .bottomTrailing
),
lineWidth: glowPulse ? 4 : 3
)
}
}
.scaleEffect(glowPulse ? 1.02 : 1.0)
.animation(
.easeInOut(duration: 0.7).repeatForever(autoreverses: true),
value: glowPulse
)
} else {
content
}
} }
} }

View File

@ -21,6 +21,11 @@ A feature-rich Baccarat (Punto Banco) app for iOS built with SwiftUI. Experience
- Animated card dealing with sound effects and haptics - Animated card dealing with sound effects and haptics
- Automatic shoe reshuffling with burn card - Automatic shoe reshuffling with burn card
### ⚙️ Settings & Customization
- Dealing animations toggle and adjustable dealing speed
- Card reveal style: Auto (instant flip), Tap (per-card), Squeeze (peek/drag reveal)
- Persistent preferences via iCloud sync
### 💰 Betting Options ### 💰 Betting Options
#### Main Bets #### Main Bets