big u/i restructures - still ugly
This commit is contained in:
@@ -10,6 +10,7 @@ struct ArmourCalculatorView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
RerollPickerView(mode: $current.saveRerollMode)
|
||||
HStack(alignment: .top) {
|
||||
Spacer()
|
||||
StatStepper(
|
||||
@@ -23,7 +24,6 @@ struct ArmourCalculatorView: View {
|
||||
ToggleChip(label: "Invulnerable", isOn: $current.invulnerable)
|
||||
Spacer()
|
||||
}
|
||||
RerollPickerView(mode: $current.saveRerollMode)
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
@@ -8,12 +8,14 @@ import SwiftUI
|
||||
struct DieView: View {
|
||||
let whichDie: Dice.DiceType
|
||||
@EnvironmentObject var current: Roll
|
||||
var colorSelected: Color = Color.green.opacity(0.75)
|
||||
var colorPrimary: Color = Color.yellow
|
||||
|
||||
var body: some View {
|
||||
let size = 22.0
|
||||
let displayColorHit = (whichDie.rawValue >= current.cutoff.rawValue) ? Color.red : Color.primary
|
||||
let displayColorArmor = (whichDie.rawValue <= current.cutoff.rawValue) ? Color.red : Color.primary
|
||||
let displayColorArmorText = (whichDie.rawValue < current.cutoff.rawValue) ? Color.red : Color.primary
|
||||
let size = 42.0
|
||||
let displayColorHit = (whichDie.rawValue >= current.cutoff.rawValue) ? colorSelected : colorPrimary
|
||||
let displayColorArmor = (whichDie.rawValue <= current.cutoff.rawValue) ? colorSelected : colorPrimary
|
||||
let displayColorArmorText = (whichDie.rawValue < current.cutoff.rawValue) ? colorSelected : colorPrimary
|
||||
|
||||
VStack(spacing: 2) {
|
||||
Text(String(current.dice.value(which: whichDie)))
|
||||
|
||||
@@ -11,6 +11,8 @@ struct HitCalculatorView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
RerollPickerView(mode: $current.hitRerollMode)
|
||||
.disabledWithOpacity(current.torrent)
|
||||
HStack(alignment: .top) {
|
||||
Spacer()
|
||||
StatStepper(
|
||||
@@ -40,18 +42,19 @@ struct HitCalculatorView: View {
|
||||
.disabledWithOpacity(current.blowupUsed || current.torrent)
|
||||
Spacer()
|
||||
}
|
||||
RerollPickerView(mode: $current.hitRerollMode)
|
||||
.disabledWithOpacity(current.torrent)
|
||||
|
||||
HStack(spacing: 6) {
|
||||
ToggleChip(label: "Torrent", isOn: $current.torrent)
|
||||
Spacer()
|
||||
ToggleChip(label: "Psychic", isOn: $current.psychic)
|
||||
.disabledWithOpacity(current.torrent)
|
||||
ToggleChip(label: "Lethal Hits", isOn: $current.lethalHits)
|
||||
Spacer()
|
||||
ToggleChip(label: "Lethal", isOn: $current.lethalHits)
|
||||
}
|
||||
.padding(.horizontal)
|
||||
VStack(spacing: 8) {
|
||||
HStack {
|
||||
ToggleChip(label: "Sust. Hits", isOn: $current.sustainedHits)
|
||||
ToggleChip(label: "Sustained Hits", isOn: $current.sustainedHits)
|
||||
Spacer()
|
||||
if current.sustainedHits {
|
||||
Text("X:")
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@available(iOS 26.0, *)
|
||||
struct RerollPickerView: View {
|
||||
@EnvironmentObject var current: Roll
|
||||
@Binding var mode: RerollMode
|
||||
@@ -24,30 +23,18 @@ struct RerollPickerView: View {
|
||||
)
|
||||
HStack(spacing: 8) {
|
||||
Text("Reroll")
|
||||
HStack(spacing: 6) {
|
||||
Picker("Reroll", selection: actionBinding) {
|
||||
ForEach(RerollMode.allCases, id: \.self) { m in
|
||||
let isSelected = mode == m
|
||||
Button(action: { actionBinding.wrappedValue = m }) {
|
||||
Text(m.label)
|
||||
.fontWeight(isSelected ? .semibold : .regular)
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 6)
|
||||
.foregroundColor(isSelected ? Color(UIColor.systemBackground) : .primary)
|
||||
.background(isSelected ? Color.green : Color.gray)
|
||||
.clipShape(Capsule())
|
||||
.overlay(Capsule().stroke(Color.primary, lineWidth: 1))
|
||||
.glassEffect()
|
||||
}
|
||||
Text(m.label).tag(m)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
if #available(iOS 26.0, *) {
|
||||
RerollPickerView(mode: .constant(.none))
|
||||
.environmentObject(Roll())
|
||||
}
|
||||
RerollPickerView(mode: .constant(.none))
|
||||
.environmentObject(Roll())
|
||||
}
|
||||
|
||||
@@ -10,49 +10,57 @@ struct RollSummaryView: View {
|
||||
@State private var showFillView = false
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 12) {
|
||||
Button(action: { showFillView.toggle() }) {
|
||||
VStack(spacing: 4) {
|
||||
VStack{
|
||||
HStack(spacing: 12) {
|
||||
VStack {
|
||||
Text("Dice Pool")
|
||||
.font(.caption)
|
||||
Text(String(current.total))
|
||||
.font(.system(size: 28, weight: .black))
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 12)
|
||||
.background(Color.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||
.foregroundColor(.black)
|
||||
}
|
||||
.sheet(isPresented: $showFillView,
|
||||
onDismiss: { current.resetPool() }) {
|
||||
VStack {
|
||||
AddToPool()
|
||||
Button("Accept", action: { showFillView.toggle() })
|
||||
.padding(20)
|
||||
}
|
||||
}
|
||||
Button(action: current.incrementState) {
|
||||
VStack(spacing: 4) {
|
||||
Text(current.state.text())
|
||||
.font(.caption)
|
||||
Text(String(current.result))
|
||||
.font(.system(size: 28, weight: .black))
|
||||
if current.state == .armour && current.mortalWoundsTotal > 0 {
|
||||
Text("mortal: \(current.mortalWoundsTotal)")
|
||||
.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(Color.blue.opacity(0.7)))
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 12)
|
||||
.background(Color.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||
.foregroundColor(.black)
|
||||
.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(Color.red.opacity(0.7)))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
DiePoolView()
|
||||
}
|
||||
.padding()
|
||||
.background(Color.black)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14))
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color.gray)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ struct WoundCalculatorView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
RerollPickerView(mode: $current.woundRerollMode)
|
||||
HStack(alignment: .top) {
|
||||
Spacer()
|
||||
StatStepper(
|
||||
@@ -37,7 +38,6 @@ struct WoundCalculatorView: View {
|
||||
)
|
||||
Spacer()
|
||||
}
|
||||
RerollPickerView(mode: $current.woundRerollMode)
|
||||
HStack {
|
||||
ToggleChip(label: "Devastating Wounds", isOn: $current.devastatingWounds)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user