diff --git a/.DS_Store b/.DS_Store index 86a291f..7f97615 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/3DModel/CatPiece.usdz b/3DModel/CatPiece.usdz new file mode 100644 index 0000000..021f023 Binary files /dev/null and b/3DModel/CatPiece.usdz differ diff --git a/3DModel/LionPiece.usdz b/3DModel/LionPiece.usdz new file mode 100644 index 0000000..64eea9f Binary files /dev/null and b/3DModel/LionPiece.usdz differ diff --git a/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj b/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj index d8444a1..8dfa190 100644 --- a/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj +++ b/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj @@ -12,7 +12,6 @@ 82CE59EF2C0460E500ADEE24 /* SpriteMoople.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82CE59EE2C0460E500ADEE24 /* SpriteMoople.swift */; }; C20310D82BFCC2410031657D /* GeneralParametersMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20310D72BFCC2410031657D /* GeneralParametersMenuView.swift */; }; C205A2B72BF373360097BD93 /* ArkitDoushiQiApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205A2B62BF373360097BD93 /* ArkitDoushiQiApp.swift */; }; - C205A2B92BF373360097BD93 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205A2B82BF373360097BD93 /* ContentView.swift */; }; C205A2BB2BF373380097BD93 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C205A2BA2BF373380097BD93 /* Assets.xcassets */; }; C205A2BE2BF373380097BD93 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C205A2BD2BF373380097BD93 /* Preview Assets.xcassets */; }; C205A2C82BF373380097BD93 /* WtaTennisTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205A2C72BF373380097BD93 /* WtaTennisTests.swift */; }; @@ -64,7 +63,6 @@ C20310D72BFCC2410031657D /* GeneralParametersMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralParametersMenuView.swift; sourceTree = ""; }; C205A2B32BF373360097BD93 /* ArkitDoushiQi.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ArkitDoushiQi.app; sourceTree = BUILT_PRODUCTS_DIR; }; C205A2B62BF373360097BD93 /* ArkitDoushiQiApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArkitDoushiQiApp.swift; sourceTree = ""; }; - C205A2B82BF373360097BD93 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; C205A2BA2BF373380097BD93 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; C205A2BD2BF373380097BD93 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; C205A2C32BF373380097BD93 /* ArkitDoushiQiTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ArkitDoushiQiTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -174,7 +172,7 @@ C2F015072C09D366000F7221 /* Utils */, 82CE59E52C045C7500ADEE24 /* Game */, C205A2B62BF373360097BD93 /* ArkitDoushiQiApp.swift */, - C205A2B82BF373360097BD93 /* ContentView.swift */, + C24659E42BF5FE09004E80D5 /* MainMenu.swift */, C205A2BA2BF373380097BD93 /* Assets.xcassets */, C205A2BC2BF373380097BD93 /* Views */, ); @@ -190,7 +188,6 @@ C2F0150A2C09D3A4000F7221 /* EventTriggers */, C25220EC2C00AC530026B71F /* GameParametersMenu */, C25220EB2C00A9230026B71F /* GeneralParametersMenu */, - C25220EA2C00A9010026B71F /* MainMenu */, C205A2BD2BF373380097BD93 /* Preview Assets.xcassets */, ); path = Views; @@ -213,14 +210,6 @@ path = ArkitDoushiQiUITests; sourceTree = ""; }; - C25220EA2C00A9010026B71F /* MainMenu */ = { - isa = PBXGroup; - children = ( - C24659E42BF5FE09004E80D5 /* MainMenu.swift */, - ); - path = MainMenu; - sourceTree = ""; - }; C25220EB2C00A9230026B71F /* GeneralParametersMenu */ = { isa = PBXGroup; children = ( @@ -464,7 +453,6 @@ C2F015112C09D3C3000F7221 /* AI.swift in Sources */, C2F0152A2C09D420000F7221 /* Stub.swift in Sources */, C2F015252C09D3E7000F7221 /* ItemCollectionParty.swift in Sources */, - C205A2B92BF373360097BD93 /* ContentView.swift in Sources */, 82CE59EF2C0460E500ADEE24 /* SpriteMoople.swift in Sources */, C2F0150C2C09D3A4000F7221 /* KeyboardReadable.swift in Sources */, 82CE59E92C045D1100ADEE24 /* GameScene.swift in Sources */, diff --git a/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift b/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift index 2ccbca9..f244895 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift @@ -22,9 +22,8 @@ struct ArkitDoushiQiApp: App { var body: some Scene { WindowGroup { MainMenu( - playButtonText: "Play", - registeredGamesButtonText: "Registered Games", - parametersButtonText: "Parameters" + playButtonText: "Play", registeredGamesButtonText: "Registered Games") + .environmentObject(LanguageSettings(selectedLanguage: .French) ) .environmentObject(languageSettings) .preferredColorScheme(isDarkMode ? .dark : .light) diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/BackGroundImage.png b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/BackGroundImage.png new file mode 100644 index 0000000..be66b1f Binary files /dev/null and b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/BackGroundImage.png differ diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/Contents.json b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/Contents.json new file mode 100644 index 0000000..7db4330 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "BackGroundImage.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/ContentView.swift b/ArkitDoushiQi/ArkitDoushiQi/ContentView.swift deleted file mode 100644 index 309e5b4..0000000 --- a/ArkitDoushiQi/ArkitDoushiQi/ContentView.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// ContentView.swift -// WtaTennis -// -// Created by Johan LACHENAL on 14/05/2024. -// - -import SwiftUI - -struct ContentView: View { - var body: some View { - VStack { - Image(systemName: "globe") - .imageScale(.large) - .foregroundColor(.accentColor) - Text("Hello, world!") - } - .padding() - } -} - -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - ContentView() - } -} diff --git a/ArkitDoushiQi/ArkitDoushiQi/MainMenu.swift b/ArkitDoushiQi/ArkitDoushiQi/MainMenu.swift new file mode 100644 index 0000000..15bddc3 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/MainMenu.swift @@ -0,0 +1,106 @@ +// +// MainMenu.swift +// ArkitDoushiQi +// +// Created by Johan LACHENAL on 16/05/2024. +// + +import SwiftUI + +struct MainMenu: View { + @EnvironmentObject var languageSettings: LanguageSettings + let playButtonText: String + let registeredGamesButtonText: String + @State private var action: Int? = 0 + @AppStorage("isDarkMode") private var isDarkMode = false + @State private var reloadView = false + + var body: some View { + NavigationView { + ZStack { + // Ajouter l'image en arrière-plan + Image("BackGroundMenu") + .resizable() + .aspectRatio(contentMode: .fill) + .edgesIgnoringSafeArea(.all) + .frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height) + + + VStack { + // Ajouter un HStack pour le titre et l'icône des paramètres + HStack { + + Button(action: { + isDarkMode.toggle() + }) { + Image(systemName: isDarkMode ? "sun.max.fill" : "moon.fill") + .foregroundColor(.white) + .padding() + } + + Button(action: { + // Action pour changer la langue + NotificationCenter.default.post(name: NSNotification.Name("LanguageChanged"), object: nil) + }) { + Image(systemName: "globe") + .foregroundColor(.white) + .padding() + } + + } + + Spacer() + + // Bouton "Jouer" au centre et plus grand, sans bandeau bleu + NavigationLink(destination: GameParametersMenuView()) + { + Text(playButtonText) + .font(.largeTitle) + .bold() + .frame(maxWidth: .infinity) + .padding() + .background(Color.white.opacity(0.2)) + .foregroundColor(.white) + .cornerRadius(10) + .overlay( + RoundedRectangle(cornerRadius: 10) + .stroke(Color.white, lineWidth: 2) + ) + .shadow(radius: 10) + } + .padding(.horizontal, 50) + + + Spacer().frame(height: 40) + + // Bouton "Parties enregistrées" plus discret + NavigationLink(destination: PartyListView()) + { + Text(registeredGamesButtonText) + .font(.headline) + .padding() + .background(Color.gray.opacity(0.7)) + .foregroundColor(.white) + .cornerRadius(10) + .shadow(radius: 5) + } + .padding(.horizontal, 50) + + Spacer() + } + .padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32)) + } + .environmentObject(languageSettings) + .onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("LanguageChanged"))) { _ in + self.reloadView.toggle() // Changez la valeur pour forcer le rechargement + } + } + } +} + +struct MainMenu_Previews: PreviewProvider { + static var previews: some View { + MainMenu(playButtonText: "Play", registeredGamesButtonText: "Registered Games") + .environmentObject(LanguageSettings(selectedLanguage: .French)) + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ItemCollectionParty.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ItemCollectionParty.swift index 997236b..af2969b 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ItemCollectionParty.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ItemCollectionParty.swift @@ -39,9 +39,8 @@ struct ItemCollectionParty: View { .frame(maxWidth: geometry.size.width * 0.25, alignment: .leading) Text("\(party.player1Score)") - .font(.largeTitle) .fontWeight(.bold) - .foregroundColor(.green) // Gagnant en vert + .foregroundColor(.red) // Perdent en vert } } @@ -59,9 +58,9 @@ struct ItemCollectionParty: View { .frame(maxWidth: geometry.size.width * 0.25, alignment: .trailing) Text("\(party.player2Score)") - .font(.largeTitle) + .fontWeight(.bold) - .foregroundColor(.red) // Perdant en rouge + .foregroundColor(.green) // Gagnant en rouge } Image(party.player2Image) @@ -85,7 +84,7 @@ struct ItemCollectionParty: View { struct ItemCollectionParty_Previews: PreviewProvider { static var previews: some View { - ItemCollectionParty(party: Party(player1Name: "L'invaincu du samedi", player1Score: 2, player1Image: "Perceval", player2Name: "Le gars du dimanche", player2Score: 1, player2Image: "Perceval", date: "Samedi soir")) + ItemCollectionParty(party: Party(player1Name: "L'invaincu du samedi", player1Score: "Défaite", player1Image: "Perceval", player2Name: "Le gars du dimanche", player2Score: "Victoire", player2Image: "Perceval", date: "Samedi soir")) .previewLayout(.sizeThatFits) .padding() } diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift deleted file mode 100644 index 0f7ce70..0000000 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// MainMenu.swift -// ArkitDoushiQi -// -// Created by Johan LACHENAL on 16/05/2024. -// - -import SwiftUI - -struct MainMenu: View { - @EnvironmentObject var languageSettings: LanguageSettings - let playButtonText: String - let registeredGamesButtonText: String - let parametersButtonText: String - @State private var action: Int? = 0 - @AppStorage("isDarkMode") private var isDarkMode = false - @State private var reloadView = false // Déclarer reloadView ici - - var body: some View { - ZStack { - NavigationView { - VStack { - Spacer() - HStack() { - Text("DouShiQi") - .bold() - .font(.title).padding() - } - Spacer().frame(height: 40) - VStack(alignment: .leading) { - ButtonComponent(title: playButtonText) - { GameParametersMenuView() } - Spacer().frame(height: 30) - ButtonComponent(title: registeredGamesButtonText) - { PartyListView() } - Spacer().frame(height: 30) - ButtonComponent(title: parametersButtonText) - { GeneralParametersMenuView( - selectedAIOption: .RandomAction, - selectedRulesOption: .Regular - ).id(reloadView) // Utilisez l'ID pour forcer le rechargement de la vue - } - } - Spacer() - } - .padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32)) - } - .environmentObject(languageSettings) - .onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("LanguageChanged"))) { _ in - self.reloadView.toggle() // Changez la valeur pour forcer le rechargement - } - } - } -} - -struct MainMenu_Previews: PreviewProvider { - static var previews: some View { - MainMenu(playButtonText: "Jouer", registeredGamesButtonText: "Parties enregistrées", parametersButtonText: "Paramètres") - .environmentObject(LanguageSettings(selectedLanguage: .French)) - } -} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/PartyEnregistery/PartyEnregistery.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/PartyEnregistery/PartyEnregistery.swift index f459540..d036c61 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/PartyEnregistery/PartyEnregistery.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/PartyEnregistery/PartyEnregistery.swift @@ -11,8 +11,8 @@ import SwiftUI struct PartyListView: View { let parties: [Party] = [ - Party(player1Name: "L'invaincu du samedi", player1Score: 2, player1Image: "Perceval", player2Name: "Le gars du dimanche", player2Score: 1, player2Image: "Perceval", date: "Samedi soir"), - Party(player1Name: "Le champion du vendredi", player1Score: 3, player1Image: "Perceval", player2Name: "Le perdant du lundi", player2Score: 0, player2Image: "Perceval", date: "Vendredi soir") + Party(player1Name: "Jack", player1Score: "Défaite", player1Image: "Perceval", player2Name: "Le gars du dimanche", player2Score: "Victoire", player2Image: "Perceval", date: "Samedi soir"), + Party(player1Name: "Le gars du dimanche", player1Score: "Victoire", player1Image: "Perceval", player2Name: "Jack", player2Score: "Défaite", player2Image: "Perceval", date: "Vendredi soir") // Ajoutez plus de parties ici ] diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/PartyEnregistery/Stub.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/PartyEnregistery/Stub.swift index 08bac26..5501b88 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/PartyEnregistery/Stub.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/PartyEnregistery/Stub.swift @@ -10,10 +10,10 @@ import SwiftUI struct Party: Identifiable { let id = UUID() let player1Name: String - let player1Score: Int + let player1Score: String let player1Image: String let player2Name: String - let player2Score: Int + let player2Score: String let player2Image: String let date: String }