Signed-off-by: Matt Bruce <matt.bruce1@toyota.com>
This commit is contained in:
parent
ace6303a62
commit
8402432363
@ -30,8 +30,22 @@ struct ResultBannerView: View {
|
|||||||
currentBalance < minBet
|
currentBalance < minBet
|
||||||
}
|
}
|
||||||
|
|
||||||
private var mainResultColor: Color {
|
/// Overall result based on total winnings (what the player actually cares about)
|
||||||
result.mainHandResult.color
|
private var overallResultText: String {
|
||||||
|
if result.totalWinnings > 0 {
|
||||||
|
return String(localized: "WIN!")
|
||||||
|
} else if result.totalWinnings < 0 {
|
||||||
|
return String(localized: "LOSE")
|
||||||
|
} else {
|
||||||
|
return String(localized: "PUSH")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Color based on overall result
|
||||||
|
private var overallResultColor: Color {
|
||||||
|
if result.totalWinnings > 0 { return .green }
|
||||||
|
if result.totalWinnings < 0 { return .red }
|
||||||
|
return .blue
|
||||||
}
|
}
|
||||||
|
|
||||||
private var winningsText: String {
|
private var winningsText: String {
|
||||||
@ -57,10 +71,10 @@ struct ResultBannerView: View {
|
|||||||
|
|
||||||
// Content card
|
// Content card
|
||||||
VStack(spacing: Design.Spacing.xLarge) {
|
VStack(spacing: Design.Spacing.xLarge) {
|
||||||
// Main result
|
// Overall result based on total winnings
|
||||||
Text(result.mainHandResult.displayText)
|
Text(overallResultText)
|
||||||
.font(.system(size: titleFontSize, weight: .black, design: .rounded))
|
.font(.system(size: titleFontSize, weight: .black, design: .rounded))
|
||||||
.foregroundStyle(mainResultColor)
|
.foregroundStyle(overallResultColor)
|
||||||
|
|
||||||
// Winnings
|
// Winnings
|
||||||
Text(winningsText)
|
Text(winningsText)
|
||||||
@ -184,12 +198,12 @@ struct ResultBannerView: View {
|
|||||||
.overlay(
|
.overlay(
|
||||||
RoundedRectangle(cornerRadius: Design.CornerRadius.xxLarge)
|
RoundedRectangle(cornerRadius: Design.CornerRadius.xxLarge)
|
||||||
.strokeBorder(
|
.strokeBorder(
|
||||||
mainResultColor.opacity(Design.Opacity.medium),
|
overallResultColor.opacity(Design.Opacity.medium),
|
||||||
lineWidth: Design.LineWidth.medium
|
lineWidth: Design.LineWidth.medium
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.shadow(color: mainResultColor.opacity(Design.Opacity.hint), radius: Design.Shadow.radiusXLarge)
|
.shadow(color: overallResultColor.opacity(Design.Opacity.hint), radius: Design.Shadow.radiusXLarge)
|
||||||
.frame(maxWidth: CasinoDesign.Size.maxModalWidth)
|
.frame(maxWidth: CasinoDesign.Size.maxModalWidth)
|
||||||
.padding(.horizontal, Design.Spacing.large) // Prevent clipping on sides
|
.padding(.horizontal, Design.Spacing.large) // Prevent clipping on sides
|
||||||
.scaleEffect(showContent ? Design.Scale.normal : Design.Scale.slightShrink)
|
.scaleEffect(showContent ? Design.Scale.normal : Design.Scale.slightShrink)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user