GameParametersMenuView #17
Merged
johan.lachenal
merged 3 commits from GameParametersMenuView
into dev
11 months ago
Binary file not shown.
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "1.000",
|
||||||
|
"green" : "1.000",
|
||||||
|
"red" : "1.000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "light"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "1.000",
|
||||||
|
"green" : "1.000",
|
||||||
|
"red" : "1.000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"platform" : "ios",
|
||||||
|
"reference" : "darkTextColor"
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "1.000",
|
||||||
|
"green" : "1.000",
|
||||||
|
"red" : "1.000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "light"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"platform" : "universal",
|
||||||
|
"reference" : "labelColor"
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"platform" : "universal",
|
||||||
|
"reference" : "systemGrayColor"
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "1.000",
|
||||||
|
"green" : "1.000",
|
||||||
|
"red" : "1.000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "light"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"platform" : "ios",
|
||||||
|
"reference" : "darkTextColor"
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "1.000",
|
||||||
|
"green" : "1.000",
|
||||||
|
"red" : "1.000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
//
|
||||||
|
// PhotoButtonComponent.swift
|
||||||
|
// ArkitDoushiQi
|
||||||
|
//
|
||||||
|
// Created by Johan LACHENAL on 27/05/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
|
||||||
|
var picker: accessCameraView
|
||||||
|
|
||||||
|
init(picker: accessCameraView) {
|
||||||
|
self.picker = picker
|
||||||
|
}
|
||||||
|
|
||||||
|
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
|
||||||
|
guard let selectedImage = info[.originalImage] as? UIImage else { return }
|
||||||
|
self.picker.selectedImage = selectedImage
|
||||||
|
self.picker.isPresented.wrappedValue.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct accessCameraView: UIViewControllerRepresentable {
|
||||||
|
|
||||||
|
@Binding var selectedImage: UIImage?
|
||||||
|
@Environment(\.presentationMode) var isPresented
|
||||||
|
|
||||||
|
func makeUIViewController(context: Context) -> UIImagePickerController {
|
||||||
|
let imagePicker = UIImagePickerController()
|
||||||
|
imagePicker.sourceType = .camera
|
||||||
|
imagePicker.allowsEditing = true
|
||||||
|
imagePicker.delegate = context.coordinator
|
||||||
|
return imagePicker
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeCoordinator() -> Coordinator {
|
||||||
|
return Coordinator(picker: self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PhotoButtonComponent: View {
|
||||||
|
let Value : String
|
||||||
|
@State private var showCamera = false
|
||||||
|
@State private var selectedImage: UIImage?
|
||||||
|
@State var image: UIImage?
|
||||||
|
var body: some View {
|
||||||
|
VStack {
|
||||||
|
if let selectedImage{
|
||||||
|
Image(uiImage: selectedImage)
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(Value) {
|
||||||
|
self.showCamera.toggle()
|
||||||
|
}
|
||||||
|
.fullScreenCover(isPresented: self.$showCamera) {
|
||||||
|
accessCameraView(selectedImage: self.$selectedImage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PhotoButtonComponent_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
PhotoButtonComponent(Value : "Prendre Photo")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// ProfileComponent.swift
|
||||||
|
// ArkitDoushiQi
|
||||||
|
//
|
||||||
|
// Created by Johan LACHENAL on 27/05/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct ProfileComponent: View {
|
||||||
|
var body: some View {
|
||||||
|
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProfileComponent_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
ProfileComponent()
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// GameView.swift
|
||||||
|
// ArkitDoushiQi
|
||||||
|
//
|
||||||
|
// Created by Johan LACHENAL on 27/05/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct GameView: View {
|
||||||
|
var body: some View {
|
||||||
|
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GameView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
GameView()
|
||||||
|
}
|
||||||
|
}
|
@ -1,29 +1,56 @@
|
|||||||
////
|
|
||||||
//// GameParametersMenuView.swift
|
|
||||||
//// ArkitDoushiQi
|
|
||||||
////
|
|
||||||
//// Created by Johan LACHENAL on 24/05/2024.
|
|
||||||
////
|
|
||||||
//
|
//
|
||||||
//import SwiftUI
|
// GameParametersMenuView.swift
|
||||||
|
// ArkitDoushiQi
|
||||||
//
|
//
|
||||||
//struct GameParametersMenuView: View {
|
// Created by Johan LACHENAL on 24/05/2024.
|
||||||
//// enum Rules: String, CaseIterable, Identifiable, Hashable {
|
|
||||||
//// case Easy = "Simplifié"
|
|
||||||
//// case Regular = "Normal"
|
|
||||||
//// var id: String { self.rawValue }
|
|
||||||
//// }
|
|
||||||
// var body: some View {
|
|
||||||
//
|
//
|
||||||
//// PickerComponent(title: "Sélectionne les règles :",
|
|
||||||
//// selectedOption: $selectedRulesOption,
|
import SwiftUI
|
||||||
//// options: Rules.allCases)
|
import PhotosUI
|
||||||
// }
|
|
||||||
//
|
enum AIT: String, CaseIterable, Identifiable, Hashable {
|
||||||
//}
|
case RandomAction = "IA Random"
|
||||||
//
|
case EasyTrainedAI = "IA Facile"
|
||||||
//struct GameParametersMenuView_Previews: PreviewProvider {
|
case MediumTrainedAI = "IA Intermédiaire"
|
||||||
// static var previews: some View {
|
|
||||||
// GameParametersMenuView()
|
var id: String { self.rawValue }
|
||||||
// }
|
}
|
||||||
//}
|
|
||||||
|
enum Rules: String, CaseIterable, Identifiable, Hashable {
|
||||||
|
case Easy = "Simplifié"
|
||||||
|
case Regular = "Normal"
|
||||||
|
var id: String { self.rawValue }
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GameParametersMenuView: View {
|
||||||
|
@State private var selectedAIOption: AIT = .RandomAction
|
||||||
|
@State private var selectedRulesOption: Rules = .Regular
|
||||||
|
var body: some View {
|
||||||
|
NavigationView {
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
HStack(alignment: .center) {
|
||||||
|
Text("Paramètres de partie").bold().font(.title)
|
||||||
|
}.frame(maxWidth: .infinity)
|
||||||
|
PickerComponent(title: "Sélectionne les règles :",
|
||||||
|
selectedOption: $selectedRulesOption,
|
||||||
|
options: Rules.allCases)
|
||||||
|
PickerComponent(title: "Sélectionne une IA :",
|
||||||
|
selectedOption: $selectedAIOption,
|
||||||
|
options: AIT.allCases)
|
||||||
|
EditComponent(explanation: "Nom du joueur 1", value: "Joueur 1")
|
||||||
|
EditComponent(explanation: "Nom du joueur 2",value: "Joueur 2")
|
||||||
|
ButtonComponent(title: "Lancer la partie") {
|
||||||
|
GameView()
|
||||||
|
}.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))
|
||||||
|
}
|
||||||
|
.frame(maxHeight: .infinity, alignment: .top)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GameParametersMenuView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
GameParametersMenuView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue