룰렛 변경

- 확률 수동 설정
- 여러개의 룰렛이 켜져있을 때 선택하여 돌리기
- 후원 히스토리에 룰렛 히스토리
This commit is contained in:
Yu Sung
2024-05-11 02:56:52 +09:00
parent 57abeea432
commit cab719c774
21 changed files with 339 additions and 265 deletions

View File

@@ -12,10 +12,7 @@ struct RouletteSettingsOptionView: View {
@ObservedObject var option: RouletteOption
let index: Int
let onClickPlus: () -> Void
let onClickDelete: () -> Void
let onClickSubstract: () -> Void
var body: some View {
VStack(spacing: 6.7) {
@@ -47,19 +44,28 @@ struct RouletteSettingsOptionView: View {
.background(Color(hex: "222222"))
.cornerRadius(6.7)
Text("\(option.percentage)%")
HStack(spacing: 0) {
TextField("0.00", text: $option.percentage)
.autocapitalization(.none)
.disableAutocorrection(true)
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
.padding(.horizontal, 13.3)
.padding(.vertical, 16.7)
.background(Color(hex: "222222"))
.cornerRadius(6.7)
Image("btn_minus_round_rect")
.onTapGesture { onClickSubstract() }
Image("btn_plus_round_rect")
.onTapGesture { onClickPlus() }
.keyboardType(.decimalPad)
.onChange(of: option.percentage) { newValue in
if newValue.count > 5 {
option.percentage = String(newValue.prefix(5))
}
}
Text("%")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
}
.padding(.horizontal, 13.3)
.padding(.vertical, 16.7)
.frame(maxWidth: 85)
.background(Color(hex: "222222"))
.cornerRadius(6.7)
}
}
}
@@ -68,11 +74,9 @@ struct RouletteSettingsOptionView: View {
struct RouletteSettingsOptionView_Previews: PreviewProvider {
static var previews: some View {
RouletteSettingsOptionView(
option: RouletteOption(title: "옵션1", weight: 1),
option: RouletteOption(title: "옵션1", percentage: ""),
index: 2,
onClickPlus: {},
onClickDelete: {},
onClickSubstract: {}
onClickDelete: {}
)
}
}