ui change
This commit is contained in:
@@ -223,6 +223,8 @@ struct MainView: View {
|
||||
.font(.system(size: controlSize))
|
||||
Text("Modifier")
|
||||
}
|
||||
.disabled(current.torrent || current.psychic)
|
||||
.opacity((current.torrent || current.psychic) ? 0.4 : 1.0)
|
||||
Spacer()
|
||||
VStack {
|
||||
Text("Blow Up")
|
||||
@@ -231,16 +233,16 @@ struct MainView: View {
|
||||
Image(systemName: "die.face.6")
|
||||
.foregroundColor(.primary)
|
||||
}
|
||||
.disabled(current.blowupUsed)
|
||||
Button(action: { current.applyBlowup(face: .five) }) {
|
||||
Image(systemName: "die.face.5")
|
||||
.foregroundColor(.primary)
|
||||
}
|
||||
.disabled(current.blowupUsed)
|
||||
}
|
||||
.padding()
|
||||
.font(.system(size: controlSize))
|
||||
}
|
||||
.disabled(current.blowupUsed || current.torrent)
|
||||
.opacity((current.blowupUsed || current.torrent) ? 0.4 : 1.0)
|
||||
Spacer()
|
||||
}
|
||||
HStack {
|
||||
@@ -258,29 +260,39 @@ struct MainView: View {
|
||||
.font(.system(size: controlSize))
|
||||
}
|
||||
.padding(.horizontal)
|
||||
.disabled(current.torrent)
|
||||
.opacity(current.torrent ? 0.4 : 1.0)
|
||||
HStack {
|
||||
Toggle("Torrent", isOn: $current.torrent)
|
||||
Spacer()
|
||||
Toggle("Psychic", isOn: $current.psychic)
|
||||
.disabled(current.torrent)
|
||||
.opacity(current.torrent ? 0.4 : 1.0)
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
//MARK: die views
|
||||
@ViewBuilder func die(whichDie: Dice.DiceType) -> some View {
|
||||
let size = 30.0
|
||||
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
|
||||
|
||||
HStack{
|
||||
Text(String(current.dice.value(which: whichDie)))
|
||||
.foregroundColor(current.state == .armour ?
|
||||
displayColorArmorText : displayColorHit)
|
||||
.frame(minWidth: 44, alignment: .trailing)
|
||||
|
||||
VStack(spacing: 2) {
|
||||
Image(systemName: "die.face." + String(whichDie.rawValue) + ".fill")
|
||||
.foregroundColor(current.state == .armour ?
|
||||
displayColorArmor : displayColorHit)
|
||||
|
||||
Text(String(current.dice.value(which: whichDie)))
|
||||
.foregroundColor(current.state == .armour ?
|
||||
displayColorArmorText : displayColorHit)
|
||||
.frame(minWidth: 30, alignment: .center)
|
||||
}
|
||||
.font(.system(size: size))
|
||||
.padding(2)
|
||||
.padding(4)
|
||||
.frame(maxWidth: .infinity)
|
||||
.gesture(TapGesture().onEnded {
|
||||
if current.state == .hit {
|
||||
if whichDie.rawValue != 1 {
|
||||
@@ -292,7 +304,7 @@ struct MainView: View {
|
||||
}
|
||||
|
||||
@ViewBuilder func diePool() -> some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack(spacing: 0) {
|
||||
ForEach(Dice.DiceType.allCases.reversed(), id: \.rawValue) { i in
|
||||
die(whichDie: i)
|
||||
}
|
||||
@@ -325,37 +337,47 @@ struct MainView: View {
|
||||
if current.state == .armour {myCircle()}
|
||||
Text(RollState.armour.print())}}
|
||||
}.font(.system(size: 60))
|
||||
VStack{
|
||||
HStack {
|
||||
VStack {
|
||||
Button(action: { showFillView.toggle() }) {
|
||||
VStack(spacing: 2) {
|
||||
Text("Dice Pool")
|
||||
.font(.caption)
|
||||
Text(String(current.total))
|
||||
.font(.system(size: 28, weight: .black))
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 8)
|
||||
.background(Color(blue).opacity(0.35))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||
.foregroundColor(.primary)
|
||||
VStack(spacing: 12) {
|
||||
HStack(spacing: 12) {
|
||||
Button(action: { showFillView.toggle() }) {
|
||||
VStack(spacing: 4) {
|
||||
Text("Dice Pool")
|
||||
.font(.caption)
|
||||
Text(String(current.total))
|
||||
.font(.system(size: 28, weight: .black))
|
||||
}
|
||||
.sheet(isPresented: $showFillView,
|
||||
onDismiss: { current.resetPool() }) {
|
||||
VStack {
|
||||
AddToPool()
|
||||
Button("Accept", action: {showFillView.toggle()})
|
||||
.padding(20)
|
||||
}
|
||||
.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) {
|
||||
buttons(color: red, label: current.state.text(), value: current.result)
|
||||
}
|
||||
Button(action: current.incrementState) {
|
||||
VStack(spacing: 4) {
|
||||
Text(current.state.text())
|
||||
.font(.caption)
|
||||
Text(String(current.result))
|
||||
.font(.system(size: 28, weight: .black))
|
||||
}
|
||||
}.padding(.leading, padSize)
|
||||
Spacer()
|
||||
diePool().padding(.trailing, padSize)
|
||||
}.frame(maxHeight: 285)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 12)
|
||||
.background(Color.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||
.foregroundColor(.black)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.background(Color.black)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14))
|
||||
diePool()
|
||||
stateView()
|
||||
}.padding()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user