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