refactor into smaller units
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// ArmourCalculatorView.swift
|
||||
// Bunch O' Dice
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ArmourCalculatorView: View {
|
||||
@EnvironmentObject var current: Roll
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
HStack(alignment: .top) {
|
||||
Spacer()
|
||||
StatStepper(
|
||||
top: "Armour",
|
||||
value: (current.armourPenetration > 0 ? "+" : "") + String(current.armourPenetration),
|
||||
bottom: "Penetration",
|
||||
increment: { current.addPenetration() },
|
||||
decrement: { current.losePenetration() }
|
||||
)
|
||||
Spacer()
|
||||
ToggleChip(label: "Invulnerable", isOn: $current.invulnerable)
|
||||
Spacer()
|
||||
}
|
||||
RerollPickerView(mode: $current.saveRerollMode)
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ArmourCalculatorView()
|
||||
.environmentObject({
|
||||
let r = Roll()
|
||||
r.state = .armour
|
||||
return r
|
||||
}())
|
||||
}
|
||||
Reference in New Issue
Block a user