diff --git a/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj b/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj index ccfb273..2e2564b 100644 --- a/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj +++ b/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 16038A272C197B800074346E /* FlagManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16038A262C197B800074346E /* FlagManager.swift */; }; + 161A8E932C2055EA00D1ADFE /* Placeholder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 161A8E922C2055EA00D1ADFE /* Placeholder.swift */; }; 165725EA2C1984CC0052D7EF /* FontManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 165725E92C1984CC0052D7EF /* FontManager.swift */; }; 165725F22C1985920052D7EF /* nuku1.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 165725F02C1985920052D7EF /* nuku1.ttf */; }; 16FA058C2C1C14F50042D688 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 16FA058A2C1C14F50042D688 /* Localizable.strings */; }; @@ -64,6 +65,7 @@ /* Begin PBXFileReference section */ 16038A262C197B800074346E /* FlagManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlagManager.swift; sourceTree = ""; }; 16038A2A2C197DEC0074346E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; + 161A8E922C2055EA00D1ADFE /* Placeholder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Placeholder.swift; sourceTree = ""; }; 165725E92C1984CC0052D7EF /* FontManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontManager.swift; sourceTree = ""; }; 165725F02C1985920052D7EF /* nuku1.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = nuku1.ttf; sourceTree = ""; }; 16FA058B2C1C14F50042D688 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Localizable.strings; sourceTree = ""; }; @@ -129,6 +131,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 161A8E912C2055EA00D1ADFE /* Extension */ = { + isa = PBXGroup; + children = ( + 161A8E922C2055EA00D1ADFE /* Placeholder.swift */, + ); + path = Extension; + sourceTree = ""; + }; 165725EB2C1985920052D7EF /* Ressources */ = { isa = PBXGroup; children = ( @@ -228,6 +238,7 @@ C205A2BC2BF373380097BD93 /* Views */ = { isa = PBXGroup; children = ( + 161A8E912C2055EA00D1ADFE /* Extension */, C2F015292C09D420000F7221 /* PartyEnregistery.swift */, C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */, C2F015122C09D3E7000F7221 /* Components */, @@ -486,6 +497,7 @@ C2F015102C09D3C3000F7221 /* Language.swift in Sources */, 165725EA2C1984CC0052D7EF /* FontManager.swift in Sources */, C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */, + 161A8E932C2055EA00D1ADFE /* Placeholder.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/BackGroundImage.png b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/BackGroundImage.png deleted file mode 100644 index be66b1f..0000000 Binary files a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/BackGroundImage.png and /dev/null differ diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/Contents.json b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_dark.imageset/Contents.json similarity index 86% rename from ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/Contents.json rename to ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_dark.imageset/Contents.json index 7db4330..bb84cad 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/BackGroundMenu.imageset/Contents.json +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_dark.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "BackGroundImage.png", + "filename" : "background_dark.svg", "idiom" : "universal", "scale" : "1x" }, diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_dark.imageset/background_dark.svg b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_dark.imageset/background_dark.svg new file mode 100644 index 0000000..7d2ba14 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_dark.imageset/background_dark.svg @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_light.imageset/Contents.json b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_light.imageset/Contents.json new file mode 100644 index 0000000..a12002b --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_light.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "background_light.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_light.imageset/background_light.svg b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_light.imageset/background_light.svg new file mode 100644 index 0000000..812ebfe --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/background_light.imageset/background_light.svg @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ArkitDoushiQi/ArkitDoushiQi/MainMenu.swift b/ArkitDoushiQi/ArkitDoushiQi/MainMenu.swift index bbefbbb..275a08f 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/MainMenu.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/MainMenu.swift @@ -2,7 +2,7 @@ // MainMenu.swift // ArkitDoushiQi // -// Created by Johan LACHENAL on 16/05/2024. +// Created by Johan LACHENAL, Louis DUFOUR on 16/05/2024. // import SwiftUI @@ -19,88 +19,105 @@ struct MainMenu: View { @Environment(\.colorScheme) var colorScheme var body: some View { - NavigationStack { - ZStack { - VStack { - Spacer().frame(height: 50) - - Text("DOUSHIQI") - .font(.custom("Nuku Nuku", size: 48, relativeTo: .largeTitle)) - .padding() - .foregroundColor(colorScheme == .dark ? .white : .black) - - Text("GAME") - .font(.custom("Nuku Nuku", size: 48, relativeTo: .largeTitle)) - .foregroundColor(colorScheme == .dark ? .white : .black) - - Spacer() + GeometryReader { geometry in + let isLandscape = geometry.size.width > geometry.size.height - NavigationLink(destination: GameParametersMenuView()) { - Text(playButtonText) - .font(.custom("Nuku Nuku", size: 32, relativeTo: .title)) - .bold() - .frame(maxWidth: .infinity) + NavigationStack { + ZStack(alignment: isLandscape ? .leading : .center) { + Image(uiImage: UIImage(named: colorScheme == .dark ? "background_dark" : "background_light")!) + .resizable() + .scaledToFit() + .frame(width: isLandscape ? geometry.size.width / 2 : geometry.size.width) + .edgesIgnoringSafeArea(.all) + + VStack { + Spacer().frame(height: 50) + + Text("DOUSHIQI") + .font(.custom("Nuku Nuku", size: 48, relativeTo: .largeTitle)) .padding() - .background(Color.white.opacity(0.2)) + .background(colorScheme == .dark ? Color.black.opacity(0.6) : Color.white.opacity(0.6)) + .cornerRadius(8) .foregroundColor(colorScheme == .dark ? .white : .black) - .cornerRadius(10) - .overlay( - RoundedRectangle(cornerRadius: 10) - .stroke(colorScheme == .dark ? Color.white : Color.black, lineWidth: 2) - ) - .shadow(radius: 10) - .padding(scaledPadding) - } - .padding(.horizontal, 50) - - Spacer().frame(height: 40) - - NavigationLink(destination: PartyListView()) { - Text(registeredGamesButtonText) - .font(.custom("Nuku Nuku", size: 18, relativeTo: .body)) + + Text("GAME") + .font(.custom("Nuku Nuku", size: 48, relativeTo: .largeTitle)) .padding() - .background(Color.gray.opacity(0.7)) + .background(colorScheme == .dark ? Color.black.opacity(0.6) : Color.white.opacity(0.6)) + .cornerRadius(8) .foregroundColor(colorScheme == .dark ? .white : .black) - .cornerRadius(10) - .shadow(radius: 5) - .padding(scaledPadding) - } - .padding(.horizontal, 50) + + Spacer() - Spacer().frame(height: 20) - - HStack { - Button(action: { - isDarkMode.toggle() - }) { - Image(systemName: isDarkMode ? "sun.max.fill" : "moon.fill") - .foregroundColor(colorScheme == .dark ? .white : .black) + NavigationLink(destination: GameParametersMenuView()) { + Text(playButtonText) + .font(.custom("Nuku Nuku", size: 32, relativeTo: .title)) + .bold() + .frame(maxWidth: .infinity) .padding() - .scaleEffect(1.2) + .background(colorScheme == .dark ? Color.black.opacity(0.6) : Color.white.opacity(0.6)) + .foregroundColor(colorScheme == .dark ? .white : .black) + .cornerRadius(8) + .overlay( + RoundedRectangle(cornerRadius: 8) + .stroke(colorScheme == .dark ? Color.white : Color.black, lineWidth: 1) + ) + .shadow(radius: 5) + .padding(scaledPadding) } + .padding(.horizontal, 50) - Button(action: { - showLanguagePicker.toggle() - }) { - Image(systemName: "globe") - .foregroundColor(colorScheme == .dark ? .white : .black) + Spacer().frame(height: 40) + + NavigationLink(destination: PartyListView()) { + Text(registeredGamesButtonText) + .font(.custom("Nuku Nuku", size: 18, relativeTo: .body)) .padding() - .scaleEffect(1.2) + .background(colorScheme == .dark ? Color.black.opacity(0.6) : Color.white.opacity(0.6)) + .foregroundColor(colorScheme == .dark ? .white : .black) + .cornerRadius(8) + .shadow(radius: 5) + .padding(scaledPadding) } - .sheet(isPresented: $showLanguagePicker) { - LanguagePickerView(showLanguagePicker: $showLanguagePicker) - .environmentObject(languageSettings) + .padding(.horizontal, 50) + + Spacer().frame(height: 20) + + HStack { + Button(action: { + isDarkMode.toggle() + }) { + Image(systemName: isDarkMode ? "sun.max.fill" : "moon.fill") + .foregroundColor(colorScheme == .dark ? .white : .black) + .padding() + .scaleEffect(1.2) + } + + Button(action: { + showLanguagePicker.toggle() + }) { + Image(systemName: "globe") + .foregroundColor(colorScheme == .dark ? .white : .black) + .padding() + .scaleEffect(1.2) + } + .sheet(isPresented: $showLanguagePicker) { + LanguagePickerView(showLanguagePicker: $showLanguagePicker) + .environmentObject(languageSettings) + } } + .padding(scaledPadding) + .background(colorScheme == .dark ? Color.black.opacity(0.6) : Color.white.opacity(0.6)) + .cornerRadius(8) + + Spacer() } - .padding(scaledPadding) - - Spacer() + .padding(EdgeInsets(top: 10, leading: isLandscape ? geometry.size.width / 2 + 32 : 32, bottom: 10, trailing: 32)) + } + .environmentObject(languageSettings) + .onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("LanguageChanged"))) { _ in + self.reloadView.toggle() } - .padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32)) - } - .environmentObject(languageSettings) - .onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("LanguageChanged"))) { _ in - self.reloadView.toggle() } } } diff --git a/ArkitDoushiQi/Ressources/images/background_dark.svg b/ArkitDoushiQi/Ressources/images/background_dark.svg new file mode 100644 index 0000000..7d2ba14 --- /dev/null +++ b/ArkitDoushiQi/Ressources/images/background_dark.svg @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ArkitDoushiQi/Ressources/images/background_light.svg b/ArkitDoushiQi/Ressources/images/background_light.svg new file mode 100644 index 0000000..812ebfe --- /dev/null +++ b/ArkitDoushiQi/Ressources/images/background_light.svg @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +