CasinoGames/Blackjack/Blackjack/Theme/DesignConstants.swift

176 lines
5.5 KiB
Swift

//
// DesignConstants.swift
// Blackjack
//
// Centralized design constants for the Blackjack app.
// Uses CasinoDesign from CasinoKit for shared values, with game-specific overrides.
//
import SwiftUI
import CasinoKit
// MARK: - Design Namespace
/// Design constants for the Blackjack app.
/// Shared constants are imported from CasinoDesign; game-specific values are defined here.
enum Design {
// MARK: - Debug
/// Set to true to show layout debug borders on views
static let showDebugBorders = false
/// Set to true to show debug log statements
static let showDebugLogs = false
/// Debug logger - only prints when showDebugLogs is true
static func debugLog(_ message: String) {
if showDebugLogs {
print(message)
}
}
// MARK: - Shared Constants (from CasinoKit)
typealias Spacing = CasinoDesign.Spacing
typealias CornerRadius = CasinoDesign.CornerRadius
typealias LineWidth = CasinoDesign.LineWidth
typealias Shadow = CasinoDesign.Shadow
typealias Opacity = CasinoDesign.Opacity
typealias Animation = CasinoDesign.Animation
typealias Scale = CasinoDesign.Scale
typealias MinScaleFactor = CasinoDesign.MinScaleFactor
typealias BaseFontSize = CasinoDesign.BaseFontSize
typealias IconSize = CasinoDesign.IconSize
// MARK: - Blackjack-Specific Sizes (use CasinoDesign.Size for shared values)
enum Size {
// Cards
static let cardWidth: CGFloat = 90
static let cardOverlap: CGFloat = -50 // Negative = more overlap
// Player hands
static let playerHandsHeight: CGFloat = 240
// Hand labels
static let handLabelFontSize: CGFloat = 14
static let handNumberFontSize: CGFloat = 12
static let handValueFontSize: CGFloat = 18
// Hints
static let hintFontSize: CGFloat = 15
static let hintIconSize: CGFloat = 24
static let hintPaddingH: CGFloat = 10
static let hintPaddingV: CGFloat = 10
// Hand icons
static let handIconSize: CGFloat = 18
// Hi-Lo count badge
static let countBadgeFontSize: CGFloat = 10
static let countBadgePaddingH: CGFloat = 6
static let countBadgePaddingV: CGFloat = 2
static let countBadgeOffset: CGFloat = 6
// Betting
static let bettingChipSize: CGFloat = 54
// Card count display
static let cardCountLabelSize: CGFloat = 11
static let cardCountValueSize: CGFloat = 18
// Table
static let tableHeight: CGFloat = 280
// Result banner
static let resultRowAmountWidth: CGFloat = 70
static let resultRowResultWidth: CGFloat = 150
// Side bet zones
static let sideBetLabelFontSize: CGFloat = 13
static let sideBetPayoutFontSize: CGFloat = 11
// Side bet toast notifications
static let sideBetToastTitleFontSize: CGFloat = 11
static let sideBetToastResultFontSize: CGFloat = 12
static let sideBetToastAmountFontSize: CGFloat = 14
}
// MARK: - Blackjack-Specific Delays
enum Delay {
/// Delay before playing game over sound
static let gameOverSound: Double = 1.0
}
// MARK: - Blackjack-Specific Animation
enum AnimationExtra {
/// Bounce for side bet toast animations
static let toastBounce: Double = 0.4
}
}
// MARK: - Blackjack App Colors
extension Color {
// MARK: - Table Colors (use CasinoTable from CasinoKit for consistency)
/// Typealias for consistent table colors across all games.
typealias Table = CasinoTable
// MARK: - Betting Zone Colors
enum BettingZone {
static let main = Color(red: 0.2, green: 0.4, blue: 0.3)
static let mainBorder = Color(red: 0.4, green: 0.6, blue: 0.4)
static let insurance = Color(red: 0.5, green: 0.4, blue: 0.2)
static let insuranceBorder = Color(red: 0.7, green: 0.6, blue: 0.3)
}
// MARK: - Hand Colors
enum Hand {
static let player = Color(red: 0.2, green: 0.5, blue: 0.8)
static let dealer = Color(red: 0.8, green: 0.3, blue: 0.3)
static let active = Color.yellow
static let inactive = Color.white.opacity(CasinoDesign.Opacity.medium)
}
// MARK: - Result Colors
enum Result {
static let win = Color.green
static let lose = Color.red
static let push = Color.blue
static let blackjack = Color.yellow
}
// MARK: - Action Button Colors (Blackjack-specific)
enum Button {
static let hit = Color(red: 0.2, green: 0.6, blue: 0.3)
static let stand = Color(red: 0.6, green: 0.4, blue: 0.1)
static let doubleDown = Color(red: 0.5, green: 0.3, blue: 0.6)
static let split = Color(red: 0.3, green: 0.5, blue: 0.7)
static let surrender = Color(red: 0.6, green: 0.3, blue: 0.3)
static let insurance = Color(red: 0.7, green: 0.6, blue: 0.2)
}
// MARK: - TopBar Colors
enum TopBar {
static let balance = Color(red: 0.95, green: 0.85, blue: 0.4)
}
// MARK: - Side Bet Colors
enum SideBet {
/// Perfect Pairs - purple theme
static let perfectPairs = Color(red: 0.4, green: 0.2, blue: 0.5)
/// 21+3 - teal/cyan theme
static let twentyOnePlusThree = Color(red: 0.1, green: 0.4, blue: 0.5)
}
}