// // RollSummaryView.swift // Bunch O' Dice // import SwiftUI struct RollSummaryView: View { @EnvironmentObject var current: Roll @State private var showFillView = false @Environment(\.dieColorSelected) var colorSelected @Environment(\.dieColorPrimary) var colorPrimary var body: some View { VStack{ HStack(spacing: 12) { VStack { Text("Dice Pool") .font(.caption) Button(action: { showFillView.toggle() }) { VStack(spacing: 4) { Text(String(current.total)) .font(.system(size: 28, weight: .black)) } .frame(maxWidth: .infinity) .padding(.vertical, 12) .clipShape(Circle()) .foregroundColor(.black) .glassEffect(.clear.tint(colorPrimary)) } } .sheet(isPresented: $showFillView, onDismiss: { current.resetPool() }) { VStack { AddToPool() Button("Accept", action: { showFillView.toggle() }) .padding(20) } } VStack { Text(current.state == .armour ? "Model Damage" : current.state.text() + "s") .font(.caption) Button(action: current.incrementState) { VStack(spacing: 4) { Text(String(current.result)) .font(.system(size: 28, weight: .black)) if current.state == .armour && current.mortalWoundsTotal > 0 { Text("mortal: \(current.mortalWoundsTotal)") .font(.caption) } } .frame(maxWidth: .infinity) .padding(.vertical, 12) .clipShape(Circle()) .foregroundColor(.black) .glassEffect(.clear.tint(colorSelected)) } } } DiePoolView() } .padding() .frame(maxWidth: .infinity) .background(Color.gray) } } #Preview { RollSummaryView() .environmentObject(Roll()) }