|
|
|
@ -29,14 +29,17 @@ struct NewGameView: View {
|
|
|
|
|
|
|
|
|
|
HStack {
|
|
|
|
|
Picker("newGame.rules.title", systemImage: "slider.horizontal.3", selection: $vm.rulesType) {
|
|
|
|
|
Text("generic.rules.classic.name").tag(RulesType.Classic)
|
|
|
|
|
ForEach(RulesType.allCases) {
|
|
|
|
|
Text($0.baseTranslationKey).tag($0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Button(action: {
|
|
|
|
|
// TODO
|
|
|
|
|
}) {
|
|
|
|
|
Image(systemName: "questionmark.circle")
|
|
|
|
|
}
|
|
|
|
|
// TODO: info button
|
|
|
|
|
// Button(action: {
|
|
|
|
|
// // TODO
|
|
|
|
|
// }) {
|
|
|
|
|
// Image(systemName: "questionmark.circle")
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Section(header: Label("newGame.dimensions", systemImage: "crop")) {
|
|
|
|
@ -75,7 +78,6 @@ private struct PlayerSectionView: View {
|
|
|
|
|
@ObservedObject
|
|
|
|
|
private var settings: PlayerSettingsVM
|
|
|
|
|
|
|
|
|
|
@State private var name: String = ""
|
|
|
|
|
@State private var photo: PhotosPickerItem? = nil
|
|
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
@ -85,16 +87,13 @@ private struct PlayerSectionView: View {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let binding: Binding<String> = if (settings.type == .Human) {
|
|
|
|
|
$name
|
|
|
|
|
} else {
|
|
|
|
|
.constant(String(localized: String.LocalizationValue("\(settings.type.baseTranslationKey).name" as String)))
|
|
|
|
|
if (settings.type == .Human) {
|
|
|
|
|
TextField("newGame.player.name", text: $settings.name)
|
|
|
|
|
// TODO: MacOS
|
|
|
|
|
//.textInputSuggestions(isEnabled: true) {
|
|
|
|
|
//
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
TextField("newGame.player.name", text: binding)
|
|
|
|
|
// TODO: MacOS
|
|
|
|
|
//.textInputSuggestions(isEnabled: true) {
|
|
|
|
|
//
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
// // TODO: actual photo support
|
|
|
|
|
// Image(systemName: "camera.viewfinder").overlay {
|
|
|
|
@ -120,6 +119,16 @@ extension PlayerType {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension RulesType {
|
|
|
|
|
var baseTranslationKey: LocalizedStringKey {
|
|
|
|
|
return switch (self) {
|
|
|
|
|
case .Classic: "generic.rules.classic.name"
|
|
|
|
|
case .TicTacToe: "generic.rules.tictactoe.name"
|
|
|
|
|
case .PopOut: "generic.rules.popout.name"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#Preview {
|
|
|
|
|
NewGameView()
|
|
|
|
|
}
|
|
|
|
|