Merge branch 'dev' into Game

pull/18/head
Your Name 11 months ago
commit 42c82851e9

BIN
.DS_Store vendored

Binary file not shown.

Binary file not shown.

@ -24,7 +24,13 @@
C205A2D22BF373380097BD93 /* WtaTennisUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205A2D12BF373380097BD93 /* WtaTennisUITests.swift */; }; C205A2D22BF373380097BD93 /* WtaTennisUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205A2D12BF373380097BD93 /* WtaTennisUITests.swift */; };
C205A2D42BF373380097BD93 /* WtaTennisUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205A2D32BF373380097BD93 /* WtaTennisUITestsLaunchTests.swift */; }; C205A2D42BF373380097BD93 /* WtaTennisUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205A2D32BF373380097BD93 /* WtaTennisUITestsLaunchTests.swift */; };
C24659E52BF5FE09004E80D5 /* MainMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24659E42BF5FE09004E80D5 /* MainMenu.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 */; }; C2F417702BFE2FBE00CFF0B3 /* howto.md in Resources */ = {isa = PBXBuildFile; fileRef = C2F4176C2BFE2FBD00CFF0B3 /* howto.md */; };
C2F417722BFE2FBE00CFF0B3 /* capture.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F4176E2BFE2FBD00CFF0B3 /* capture.png */; }; C2F417722BFE2FBE00CFF0B3 /* capture.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F4176E2BFE2FBD00CFF0B3 /* capture.png */; };
C2F417732BFE2FBE00CFF0B3 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = C2F4176F2BFE2FBD00CFF0B3 /* README.md */; }; 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 = "<group>"; }; C205A2D12BF373380097BD93 /* WtaTennisUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WtaTennisUITests.swift; sourceTree = "<group>"; };
C205A2D32BF373380097BD93 /* WtaTennisUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WtaTennisUITestsLaunchTests.swift; sourceTree = "<group>"; }; C205A2D32BF373380097BD93 /* WtaTennisUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WtaTennisUITestsLaunchTests.swift; sourceTree = "<group>"; };
C24659E42BF5FE09004E80D5 /* MainMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenu.swift; sourceTree = "<group>"; }; C24659E42BF5FE09004E80D5 /* MainMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenu.swift; sourceTree = "<group>"; };
C24659E82BF60FAA004E80D5 /* MainMenuButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuButtonComponent.swift; sourceTree = "<group>"; }; C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonComponent.swift; sourceTree = "<group>"; };
C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameParametersMenuView.swift; sourceTree = "<group>"; };
C25220F22C00AF490026B71F /* EditComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditComponent.swift; sourceTree = "<group>"; };
C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoButtonComponent.swift; sourceTree = "<group>"; };
C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileComponent.swift; sourceTree = "<group>"; };
C2F3940D2C04643A0070B4F6 /* GameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameView.swift; sourceTree = "<group>"; };
C2F4176C2BFE2FBD00CFF0B3 /* howto.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = howto.md; sourceTree = "<group>"; }; C2F4176C2BFE2FBD00CFF0B3 /* howto.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = howto.md; sourceTree = "<group>"; };
C2F4176D2BFE2FBD00CFF0B3 /* DSQ.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = DSQ.xcframework; sourceTree = "<group>"; }; C2F4176D2BFE2FBD00CFF0B3 /* DSQ.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = DSQ.xcframework; sourceTree = "<group>"; };
C2F4176E2BFE2FBD00CFF0B3 /* capture.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = capture.png; sourceTree = "<group>"; }; C2F4176E2BFE2FBD00CFF0B3 /* capture.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = capture.png; sourceTree = "<group>"; };
@ -80,6 +91,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
C2F394062C045E800070B4F6 /* DSQ.xcframework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -172,6 +184,9 @@
C205A2BC2BF373380097BD93 /* Views */ = { C205A2BC2BF373380097BD93 /* Views */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
C2F3940C2C0464260070B4F6 /* Game */,
C25220F02C00AD7F0026B71F /* Components */,
C25220EC2C00AC530026B71F /* GameParametersMenu */,
C25220EB2C00A9230026B71F /* GeneralParametersMenu */, C25220EB2C00A9230026B71F /* GeneralParametersMenu */,
C25220EA2C00A9010026B71F /* MainMenu */, C25220EA2C00A9010026B71F /* MainMenu */,
82F9D32F2BFE3A75009EDFAF /* History */, 82F9D32F2BFE3A75009EDFAF /* History */,
@ -200,7 +215,6 @@
C25220EA2C00A9010026B71F /* MainMenu */ = { C25220EA2C00A9010026B71F /* MainMenu */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
C24659E82BF60FAA004E80D5 /* MainMenuButtonComponent.swift */,
C24659E42BF5FE09004E80D5 /* MainMenu.swift */, C24659E42BF5FE09004E80D5 /* MainMenu.swift */,
); );
path = MainMenu; path = MainMenu;
@ -209,13 +223,56 @@
C25220EB2C00A9230026B71F /* GeneralParametersMenu */ = { C25220EB2C00A9230026B71F /* GeneralParametersMenu */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
C20310D92BFCC8600031657D /* ToggleComponent.swift */,
C20310D52BFCB5FB0031657D /* PickerComponent.swift */,
C20310D72BFCC2410031657D /* GeneralParametersMenuView.swift */, C20310D72BFCC2410031657D /* GeneralParametersMenuView.swift */,
); );
path = GeneralParametersMenu; path = GeneralParametersMenu;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
C25220EC2C00AC530026B71F /* GameParametersMenu */ = {
isa = PBXGroup;
children = (
C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */,
);
path = GameParametersMenu;
sourceTree = "<group>";
};
C25220F02C00AD7F0026B71F /* Components */ = {
isa = PBXGroup;
children = (
C2F394092C04636C0070B4F6 /* Visuals */,
C25220F12C00ADF70026B71F /* Controls */,
);
path = Components;
sourceTree = "<group>";
};
C25220F12C00ADF70026B71F /* Controls */ = {
isa = PBXGroup;
children = (
C20310D52BFCB5FB0031657D /* PickerComponent.swift */,
C20310D92BFCC8600031657D /* ToggleComponent.swift */,
C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */,
C25220F22C00AF490026B71F /* EditComponent.swift */,
C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */,
);
path = Controls;
sourceTree = "<group>";
};
C2F394092C04636C0070B4F6 /* Visuals */ = {
isa = PBXGroup;
children = (
C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */,
);
path = Visuals;
sourceTree = "<group>";
};
C2F3940C2C0464260070B4F6 /* Game */ = {
isa = PBXGroup;
children = (
C2F3940D2C04643A0070B4F6 /* GameView.swift */,
);
path = Game;
sourceTree = "<group>";
};
C2F4176A2BFE2F8C00CFF0B3 /* Model */ = { C2F4176A2BFE2F8C00CFF0B3 /* Model */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -372,15 +429,20 @@
82CE59EF2C0460E500ADEE24 /* SpriteMoople.swift in Sources */, 82CE59EF2C0460E500ADEE24 /* SpriteMoople.swift in Sources */,
82CE59E92C045D1100ADEE24 /* GameScene.swift in Sources */, 82CE59E92C045D1100ADEE24 /* GameScene.swift in Sources */,
82F9D3312BFE3A9F009EDFAF /* HistoryGameDetail.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 */, C24659E52BF5FE09004E80D5 /* MainMenu.swift in Sources */,
82F9D3362BFE3B3C009EDFAF /* HistoryView.swift in Sources */, 82F9D3362BFE3B3C009EDFAF /* HistoryView.swift in Sources */,
C20310D82BFCC2410031657D /* GeneralParametersMenuView.swift in Sources */, C20310D82BFCC2410031657D /* GeneralParametersMenuView.swift in Sources */,
C2F3940B2C0463940070B4F6 /* ProfileComponent.swift in Sources */,
C205A2B72BF373360097BD93 /* ArkitDoushiQiApp.swift in Sources */, C205A2B72BF373360097BD93 /* ArkitDoushiQiApp.swift in Sources */,
C25220F32C00AF490026B71F /* EditComponent.swift in Sources */,
C20310D62BFCB5FB0031657D /* PickerComponent.swift in Sources */, C20310D62BFCB5FB0031657D /* PickerComponent.swift in Sources */,
82F9D3332BFE3B12009EDFAF /* HistoryHeader.swift in Sources */, 82F9D3332BFE3B12009EDFAF /* HistoryHeader.swift in Sources */,
82CE59EB2C045E3800ADEE24 /* GameView.swift in Sources */, 82CE59EB2C045E3800ADEE24 /* GameView.swift in Sources */,
C20310DA2BFCC8600031657D /* ToggleComponent.swift in Sources */, C20310DA2BFCC8600031657D /* ToggleComponent.swift in Sources */,
C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

@ -7,12 +7,19 @@
import SwiftUI import SwiftUI
enum Theme {
static let primary = Color("Primary")
static let secondary = Color("Secondary")
static let tertiary = Color("Tertiary")
}
@main @main
struct ArkitDoushiQiApp: App { struct ArkitDoushiQiApp: App {
@AppStorage("isDarkMode") private var isDarkMode = false @AppStorage("isDarkMode") private var isDarkMode = false
var body: some Scene { var body: some Scene {
WindowGroup { WindowGroup {
ContentView() MainMenu(playButtonText: "Jouer", registeredGamesButtonText: "Parties enregistrées",ParametersButtontText: "Paramètres")
.preferredColorScheme(isDarkMode ? .dark : .light) .preferredColorScheme(isDarkMode ? .dark : .light)
} }
} }

@ -16,7 +16,7 @@
"appearances" : [ "appearances" : [
{ {
"appearance" : "luminosity", "appearance" : "luminosity",
"value" : "dark" "value" : "light"
} }
], ],
"color" : { "color" : {
@ -29,6 +29,19 @@
} }
}, },
"idiom" : "universal" "idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"platform" : "ios",
"reference" : "darkTextColor"
},
"idiom" : "universal"
} }
], ],
"info" : { "info" : {

@ -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
}
}

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
struct MainMenuButtonComponent<Content : View>: View { struct ButtonComponent<Content : View>: View {
let content: Content let content: Content
let title: String let title: String
@ -25,19 +25,19 @@ struct MainMenuButtonComponent<Content : View>: View {
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32)) .padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))
.controlSize(.large) .controlSize(.large)
.foregroundColor(.white) .foregroundColor(Color(UIColor(named: "Primary") ?? .black))
} }
.buttonBorderShape(.roundedRectangle) .buttonBorderShape(.roundedRectangle)
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
.tint(.black) .tint(Color(UIColor(named: "Tertiary") ?? .white))
} }
} }
struct MainMenuButtonComponent_Previews: PreviewProvider { struct ButtonComponent_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
NavigationView { NavigationView {
VStack { VStack {
MainMenuButtonComponent(title: "Parties enregistrées") { ButtonComponent(title: "Parties enregistrées") {
Text("Je suis un test") Text("Je suis un test")
} }
} }

@ -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")
}
}

@ -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")
}
}

@ -33,12 +33,12 @@ struct PickerComponent<EnumType: RawRepresentable & Identifiable & Hashable>: Vi
} label: { } label: {
HStack { HStack {
Text(title) Text(title)
.foregroundColor(.black)
.padding() .padding()
.foregroundColor(.primary)
Spacer() Spacer()
Text(selectedOption.rawValue.description) Text(selectedOption.rawValue.description)
.foregroundColor(.black)
.padding() .padding()
.foregroundColor(.primary)
} }
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.padding(EdgeInsets(top: 0, leading: 32, bottom: 0, trailing: 32)) .padding(EdgeInsets(top: 0, leading: 32, bottom: 0, trailing: 32))

@ -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()
}
}

@ -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()
}
}

@ -7,26 +7,12 @@
import SwiftUI 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 { enum Language: String, CaseIterable, Identifiable, Hashable {
case French = "Français" case French = "Français"
case English = "English" case English = "English"
var id: String { self.rawValue } 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 { struct GeneralParametersMenuView: View {
@State private var selectedAIOption: AIT = .RandomAction @State private var selectedAIOption: AIT = .RandomAction
@State private var selectedLanguageOption: Language = .French @State private var selectedLanguageOption: Language = .French
@ -38,15 +24,9 @@ struct GeneralParametersMenuView: View {
}.frame(maxWidth: .infinity) }.frame(maxWidth: .infinity)
Spacer().frame(maxHeight: 30) Spacer().frame(maxHeight: 30)
ToggleComponent() ToggleComponent()
PickerComponent(title: "Sélectionne une IA :",
selectedOption: $selectedAIOption,
options: AIT.allCases)
PickerComponent(title: "Sélectionne un langage :", PickerComponent(title: "Sélectionne un langage :",
selectedOption: $selectedLanguageOption, selectedOption: $selectedLanguageOption,
options: Language.allCases) options: Language.allCases)
PickerComponent(title: "Sélectionne les règles :",
selectedOption: $selectedRulesOption,
options: Rules.allCases)
}.frame(maxHeight: .infinity, alignment: .top) }.frame(maxHeight: .infinity, alignment: .top)
} }

@ -25,13 +25,13 @@ struct MainMenu: View {
} }
Spacer().frame(height: 40) Spacer().frame(height: 40)
VStack(alignment: .leading) { VStack(alignment: .leading) {
MainMenuButtonComponent(title: playButtonText) ButtonComponent(title: playButtonText)
{ Text("jeu page") } { GameParametersMenuView() }
Spacer().frame(height: 30) Spacer().frame(height: 30)
MainMenuButtonComponent(title: registeredGamesButtonText) ButtonComponent(title: registeredGamesButtonText)
{ Text("parties enregistrées page") } { Text("parties enregistrées page") }
Spacer().frame(height: 30) Spacer().frame(height: 30)
MainMenuButtonComponent(title: ParametersButtontText) ButtonComponent(title: ParametersButtontText)
{ GeneralParametersMenuView() } { GeneralParametersMenuView() }
} }
Spacer() Spacer()

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save