diff --git a/.DS_Store b/.DS_Store index 1467c31..cccd18a 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/ArkitDoushiQi/.DS_Store b/ArkitDoushiQi/.DS_Store index f39ec85..6dbb068 100644 Binary files a/ArkitDoushiQi/.DS_Store and b/ArkitDoushiQi/.DS_Store differ diff --git a/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj b/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj index a3a685e..352d4d8 100644 --- a/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj +++ b/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj @@ -24,7 +24,13 @@ C205A2D22BF373380097BD93 /* WtaTennisUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205A2D12BF373380097BD93 /* WtaTennisUITests.swift */; }; C205A2D42BF373380097BD93 /* WtaTennisUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205A2D32BF373380097BD93 /* WtaTennisUITestsLaunchTests.swift */; }; C24659E52BF5FE09004E80D5 /* MainMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24659E42BF5FE09004E80D5 /* MainMenu.swift */; }; - C24659E92BF60FAA004E80D5 /* MainMenuButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24659E82BF60FAA004E80D5 /* MainMenuButtonComponent.swift */; }; + C24659E92BF60FAA004E80D5 /* ButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */; }; + C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */; }; + C25220F32C00AF490026B71F /* EditComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25220F22C00AF490026B71F /* EditComponent.swift */; }; + C2F394062C045E800070B4F6 /* DSQ.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C2F4176D2BFE2FBD00CFF0B3 /* DSQ.xcframework */; }; + C2F394082C0462400070B4F6 /* PhotoButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */; }; + C2F3940B2C0463940070B4F6 /* ProfileComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */; }; + C2F3940E2C04643A0070B4F6 /* GameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F3940D2C04643A0070B4F6 /* GameView.swift */; }; C2F417702BFE2FBE00CFF0B3 /* howto.md in Resources */ = {isa = PBXBuildFile; fileRef = C2F4176C2BFE2FBD00CFF0B3 /* howto.md */; }; C2F417722BFE2FBE00CFF0B3 /* capture.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F4176E2BFE2FBD00CFF0B3 /* capture.png */; }; C2F417732BFE2FBE00CFF0B3 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = C2F4176F2BFE2FBD00CFF0B3 /* README.md */; }; @@ -68,7 +74,12 @@ C205A2D12BF373380097BD93 /* WtaTennisUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WtaTennisUITests.swift; sourceTree = ""; }; C205A2D32BF373380097BD93 /* WtaTennisUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WtaTennisUITestsLaunchTests.swift; sourceTree = ""; }; C24659E42BF5FE09004E80D5 /* MainMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenu.swift; sourceTree = ""; }; - C24659E82BF60FAA004E80D5 /* MainMenuButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuButtonComponent.swift; sourceTree = ""; }; + C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonComponent.swift; sourceTree = ""; }; + C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameParametersMenuView.swift; sourceTree = ""; }; + C25220F22C00AF490026B71F /* EditComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditComponent.swift; sourceTree = ""; }; + C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoButtonComponent.swift; sourceTree = ""; }; + C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileComponent.swift; sourceTree = ""; }; + C2F3940D2C04643A0070B4F6 /* GameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameView.swift; sourceTree = ""; }; C2F4176C2BFE2FBD00CFF0B3 /* howto.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = howto.md; sourceTree = ""; }; C2F4176D2BFE2FBD00CFF0B3 /* DSQ.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = DSQ.xcframework; sourceTree = ""; }; C2F4176E2BFE2FBD00CFF0B3 /* capture.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = capture.png; sourceTree = ""; }; @@ -80,6 +91,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + C2F394062C045E800070B4F6 /* DSQ.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -172,6 +184,9 @@ C205A2BC2BF373380097BD93 /* Views */ = { isa = PBXGroup; children = ( + C2F3940C2C0464260070B4F6 /* Game */, + C25220F02C00AD7F0026B71F /* Components */, + C25220EC2C00AC530026B71F /* GameParametersMenu */, C25220EB2C00A9230026B71F /* GeneralParametersMenu */, C25220EA2C00A9010026B71F /* MainMenu */, 82F9D32F2BFE3A75009EDFAF /* History */, @@ -200,7 +215,6 @@ C25220EA2C00A9010026B71F /* MainMenu */ = { isa = PBXGroup; children = ( - C24659E82BF60FAA004E80D5 /* MainMenuButtonComponent.swift */, C24659E42BF5FE09004E80D5 /* MainMenu.swift */, ); path = MainMenu; @@ -209,13 +223,56 @@ C25220EB2C00A9230026B71F /* GeneralParametersMenu */ = { isa = PBXGroup; children = ( - C20310D92BFCC8600031657D /* ToggleComponent.swift */, - C20310D52BFCB5FB0031657D /* PickerComponent.swift */, C20310D72BFCC2410031657D /* GeneralParametersMenuView.swift */, ); path = GeneralParametersMenu; sourceTree = ""; }; + C25220EC2C00AC530026B71F /* GameParametersMenu */ = { + isa = PBXGroup; + children = ( + C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */, + ); + path = GameParametersMenu; + sourceTree = ""; + }; + C25220F02C00AD7F0026B71F /* Components */ = { + isa = PBXGroup; + children = ( + C2F394092C04636C0070B4F6 /* Visuals */, + C25220F12C00ADF70026B71F /* Controls */, + ); + path = Components; + sourceTree = ""; + }; + C25220F12C00ADF70026B71F /* Controls */ = { + isa = PBXGroup; + children = ( + C20310D52BFCB5FB0031657D /* PickerComponent.swift */, + C20310D92BFCC8600031657D /* ToggleComponent.swift */, + C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */, + C25220F22C00AF490026B71F /* EditComponent.swift */, + C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */, + ); + path = Controls; + sourceTree = ""; + }; + C2F394092C04636C0070B4F6 /* Visuals */ = { + isa = PBXGroup; + children = ( + C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */, + ); + path = Visuals; + sourceTree = ""; + }; + C2F3940C2C0464260070B4F6 /* Game */ = { + isa = PBXGroup; + children = ( + C2F3940D2C04643A0070B4F6 /* GameView.swift */, + ); + path = Game; + sourceTree = ""; + }; C2F4176A2BFE2F8C00CFF0B3 /* Model */ = { isa = PBXGroup; children = ( @@ -372,15 +429,20 @@ 82CE59EF2C0460E500ADEE24 /* SpriteMoople.swift in Sources */, 82CE59E92C045D1100ADEE24 /* GameScene.swift in Sources */, 82F9D3312BFE3A9F009EDFAF /* HistoryGameDetail.swift in Sources */, - C24659E92BF60FAA004E80D5 /* MainMenuButtonComponent.swift in Sources */, + C24659E92BF60FAA004E80D5 /* ButtonComponent.swift in Sources */, + C2F394082C0462400070B4F6 /* PhotoButtonComponent.swift in Sources */, + C2F3940E2C04643A0070B4F6 /* GameView.swift in Sources */, C24659E52BF5FE09004E80D5 /* MainMenu.swift in Sources */, 82F9D3362BFE3B3C009EDFAF /* HistoryView.swift in Sources */, C20310D82BFCC2410031657D /* GeneralParametersMenuView.swift in Sources */, + C2F3940B2C0463940070B4F6 /* ProfileComponent.swift in Sources */, C205A2B72BF373360097BD93 /* ArkitDoushiQiApp.swift in Sources */, + C25220F32C00AF490026B71F /* EditComponent.swift in Sources */, C20310D62BFCB5FB0031657D /* PickerComponent.swift in Sources */, 82F9D3332BFE3B12009EDFAF /* HistoryHeader.swift in Sources */, 82CE59EB2C045E3800ADEE24 /* GameView.swift in Sources */, C20310DA2BFCC8600031657D /* ToggleComponent.swift in Sources */, + C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift b/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift index 270b422..cfe6191 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift @@ -7,12 +7,19 @@ import SwiftUI +enum Theme { + static let primary = Color("Primary") + static let secondary = Color("Secondary") + static let tertiary = Color("Tertiary") +} + @main + struct ArkitDoushiQiApp: App { @AppStorage("isDarkMode") private var isDarkMode = false var body: some Scene { WindowGroup { - ContentView() + MainMenu(playButtonText: "Jouer", registeredGamesButtonText: "Parties enregistrées",ParametersButtontText: "Paramètres") .preferredColorScheme(isDarkMode ? .dark : .light) } } diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Color.colorset/Contents.json b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Primary.colorset/Contents.json similarity index 73% rename from ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Color.colorset/Contents.json rename to ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Primary.colorset/Contents.json index 22c4bb0..6ea0e4d 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Color.colorset/Contents.json +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Primary.colorset/Contents.json @@ -16,7 +16,7 @@ "appearances" : [ { "appearance" : "luminosity", - "value" : "dark" + "value" : "light" } ], "color" : { @@ -29,6 +29,19 @@ } }, "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "platform" : "ios", + "reference" : "darkTextColor" + }, + "idiom" : "universal" } ], "info" : { diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Quaternary.colorset/Contents.json b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Quaternary.colorset/Contents.json new file mode 100644 index 0000000..6ea0e4d --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Quaternary.colorset/Contents.json @@ -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 + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Secundary.colorset/Contents.json b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Secundary.colorset/Contents.json new file mode 100644 index 0000000..e894812 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Secundary.colorset/Contents.json @@ -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 + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Tertiary.colorset/Contents.json b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Tertiary.colorset/Contents.json new file mode 100644 index 0000000..de56107 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Tertiary.colorset/Contents.json @@ -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 + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenuButtonComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/ButtonComponent.swift similarity index 78% rename from ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenuButtonComponent.swift rename to ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/ButtonComponent.swift index 01f1ca6..ed86c3f 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenuButtonComponent.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/ButtonComponent.swift @@ -7,7 +7,7 @@ import SwiftUI -struct MainMenuButtonComponent: View { +struct ButtonComponent: View { let content: Content let title: String @@ -25,19 +25,19 @@ struct MainMenuButtonComponent: View { .frame(maxWidth: .infinity) .padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32)) .controlSize(.large) - .foregroundColor(.white) + .foregroundColor(Color(UIColor(named: "Primary") ?? .black)) } .buttonBorderShape(.roundedRectangle) .buttonStyle(.borderedProminent) - .tint(.black) + .tint(Color(UIColor(named: "Tertiary") ?? .white)) } } -struct MainMenuButtonComponent_Previews: PreviewProvider { +struct ButtonComponent_Previews: PreviewProvider { static var previews: some View { NavigationView { VStack { - MainMenuButtonComponent(title: "Parties enregistrées") { + ButtonComponent(title: "Parties enregistrées") { Text("Je suis un test") } } diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditComponent.swift new file mode 100644 index 0000000..64540c9 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditComponent.swift @@ -0,0 +1,27 @@ +// +// EditComponent.swift +// ArkitDoushiQi +// +// Created by Johan LACHENAL on 24/05/2024. +// + +import SwiftUI + +struct EditComponent: View { + let explanation : String + let value : String + @State private var name = "Joueur 1" + var body: some View { + Form { + Section(header : Text(explanation)) { + TextField("Value", text : $name) + } + } + } +} + +struct EditComponent_Previews: PreviewProvider { + static var previews: some View { + EditComponent(explanation: "Nom du joueur 1", value : "Joueur 1") + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/PhotoButtonComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/PhotoButtonComponent.swift new file mode 100644 index 0000000..68abd33 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/PhotoButtonComponent.swift @@ -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") + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/PickerComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/PickerComponent.swift similarity index 95% rename from ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/PickerComponent.swift rename to ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/PickerComponent.swift index f81cf0e..72a816d 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/PickerComponent.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/PickerComponent.swift @@ -33,12 +33,12 @@ struct PickerComponent: Vi } label: { HStack { Text(title) - .foregroundColor(.black) .padding() + .foregroundColor(.primary) Spacer() Text(selectedOption.rawValue.description) - .foregroundColor(.black) .padding() + .foregroundColor(.primary) } .frame(maxWidth: .infinity) .padding(EdgeInsets(top: 0, leading: 32, bottom: 0, trailing: 32)) diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/ToggleComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/ToggleComponent.swift similarity index 100% rename from ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/ToggleComponent.swift rename to ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/ToggleComponent.swift diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileComponent.swift new file mode 100644 index 0000000..4f12d75 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileComponent.swift @@ -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() + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Game/GameView.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Game/GameView.swift new file mode 100644 index 0000000..dd07a44 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Game/GameView.swift @@ -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() + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift new file mode 100644 index 0000000..79893b5 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift @@ -0,0 +1,56 @@ +// +// GameParametersMenuView.swift +// ArkitDoushiQi +// +// Created by Johan LACHENAL on 24/05/2024. +// + +import SwiftUI +import PhotosUI + +enum AIT: String, CaseIterable, Identifiable, Hashable { + case RandomAction = "IA Random" + case EasyTrainedAI = "IA Facile" + case MediumTrainedAI = "IA Intermédiaire" + + 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() + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/GeneralParametersMenuView.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/GeneralParametersMenuView.swift index a9eb598..6a6de1b 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/GeneralParametersMenuView.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/GeneralParametersMenuView.swift @@ -7,26 +7,12 @@ import SwiftUI -enum AIT: String, CaseIterable, Identifiable, Hashable { - case RandomAction = "IA Random" - case EasyTrainedAI = "IA Facile" - case MediumTrainedAI = "IA Intermédiaire" - - var id: String { self.rawValue } -} - enum Language: String, CaseIterable, Identifiable, Hashable { case French = "Français" case English = "English" var id: String { self.rawValue } } -enum Rules: String, CaseIterable, Identifiable, Hashable { - case Easy = "Simplifié" - case Regular = "Normal" - var id: String { self.rawValue } -} - struct GeneralParametersMenuView: View { @State private var selectedAIOption: AIT = .RandomAction @State private var selectedLanguageOption: Language = .French @@ -38,15 +24,9 @@ struct GeneralParametersMenuView: View { }.frame(maxWidth: .infinity) Spacer().frame(maxHeight: 30) ToggleComponent() - PickerComponent(title: "Sélectionne une IA :", - selectedOption: $selectedAIOption, - options: AIT.allCases) PickerComponent(title: "Sélectionne un langage :", selectedOption: $selectedLanguageOption, options: Language.allCases) - PickerComponent(title: "Sélectionne les règles :", - selectedOption: $selectedRulesOption, - options: Rules.allCases) }.frame(maxHeight: .infinity, alignment: .top) } diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift index b23b30e..b1ce79c 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift @@ -25,13 +25,13 @@ struct MainMenu: View { } Spacer().frame(height: 40) VStack(alignment: .leading) { - MainMenuButtonComponent(title: playButtonText) - { Text("jeu page") } + ButtonComponent(title: playButtonText) + { GameParametersMenuView() } Spacer().frame(height: 30) - MainMenuButtonComponent(title: registeredGamesButtonText) + ButtonComponent(title: registeredGamesButtonText) { Text("parties enregistrées page") } Spacer().frame(height: 30) - MainMenuButtonComponent(title: ParametersButtontText) + ButtonComponent(title: ParametersButtontText) { GeneralParametersMenuView() } } Spacer() diff --git a/ArkitDoushiQi/Model/.DS_Store b/ArkitDoushiQi/Model/.DS_Store new file mode 100644 index 0000000..5ec6b63 Binary files /dev/null and b/ArkitDoushiQi/Model/.DS_Store differ diff --git a/ArkitDoushiQi/Model/XCFramework/.DS_Store b/ArkitDoushiQi/Model/XCFramework/.DS_Store new file mode 100644 index 0000000..930cdde Binary files /dev/null and b/ArkitDoushiQi/Model/XCFramework/.DS_Store differ diff --git a/ArkitDoushiQi/Model/XCFramework/DSQ.xcframework/.DS_Store b/ArkitDoushiQi/Model/XCFramework/DSQ.xcframework/.DS_Store new file mode 100644 index 0000000..a6188c4 Binary files /dev/null and b/ArkitDoushiQi/Model/XCFramework/DSQ.xcframework/.DS_Store differ