From 26f44c2a78ebc961346d679c4f06144e15a48754 Mon Sep 17 00:00:00 2001 From: Mathieu GROUSSEAU Date: Wed, 14 May 2025 12:03:27 +0200 Subject: [PATCH] WIP Main menu --- App/App.xcodeproj/project.pbxproj | 12 ++++--- App/App/AppApp.swift | 2 +- App/App/Localizable.xcstrings | 53 ++++++++++++++++++++++++++++++- App/App/View/ContentView.swift | 24 -------------- App/App/View/MainMenuView.swift | 28 ++++++++++++++++ App/Colors.xcassets/Contents.json | 6 ++++ 6 files changed, 95 insertions(+), 30 deletions(-) delete mode 100644 App/App/View/ContentView.swift create mode 100644 App/App/View/MainMenuView.swift create mode 100644 App/Colors.xcassets/Contents.json diff --git a/App/App.xcodeproj/project.pbxproj b/App/App.xcodeproj/project.pbxproj index 5b7800f..f5a5422 100644 --- a/App/App.xcodeproj/project.pbxproj +++ b/App/App.xcodeproj/project.pbxproj @@ -8,7 +8,7 @@ /* Begin PBXBuildFile section */ F001A04C2DD48FAB00809561 /* AppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F001A04B2DD48FAB00809561 /* AppApp.swift */; }; - F001A04E2DD48FAB00809561 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F001A04D2DD48FAB00809561 /* ContentView.swift */; }; + F001A04E2DD48FAB00809561 /* MainMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F001A04D2DD48FAB00809561 /* MainMenuView.swift */; }; F001A0502DD48FAD00809561 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F001A04F2DD48FAD00809561 /* Assets.xcassets */; }; F001A0542DD48FAD00809561 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F001A0532DD48FAD00809561 /* Preview Assets.xcassets */; }; F001A05E2DD48FAE00809561 /* AppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F001A05D2DD48FAE00809561 /* AppTests.swift */; }; @@ -19,6 +19,7 @@ F0F59E4B2DD4958800BE32D6 /* C4Players.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0F59E422DD492B400BE32D6 /* C4Players.xcframework */; }; F0F59E4C2DD4958800BE32D6 /* C4Rules.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0F59E442DD492B400BE32D6 /* C4Rules.xcframework */; }; F0F59E4F2DD4996F00BE32D6 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = F0F59E4E2DD4996F00BE32D6 /* Localizable.xcstrings */; }; + F0F59E512DD49C2800BE32D6 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F0F59E502DD49C2800BE32D6 /* Colors.xcassets */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -41,7 +42,7 @@ /* Begin PBXFileReference section */ F001A0482DD48FAB00809561 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; }; F001A04B2DD48FAB00809561 /* AppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppApp.swift; sourceTree = ""; }; - F001A04D2DD48FAB00809561 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + F001A04D2DD48FAB00809561 /* MainMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuView.swift; sourceTree = ""; }; F001A04F2DD48FAD00809561 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; F001A0512DD48FAD00809561 /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = ""; }; F001A0532DD48FAD00809561 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; @@ -55,6 +56,7 @@ F0F59E432DD492B400BE32D6 /* C4.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = C4.xcframework; path = ../precompiled/xcframeworks/C4.xcframework; sourceTree = ""; }; F0F59E442DD492B400BE32D6 /* C4Rules.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = C4Rules.xcframework; path = ../precompiled/xcframeworks/C4Rules.xcframework; sourceTree = ""; }; F0F59E4E2DD4996F00BE32D6 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; name = Localizable.xcstrings; path = App/Localizable.xcstrings; sourceTree = ""; }; + F0F59E502DD49C2800BE32D6 /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -89,6 +91,7 @@ F001A03F2DD48FAB00809561 = { isa = PBXGroup; children = ( + F0F59E502DD49C2800BE32D6 /* Colors.xcassets */, F0F59E4E2DD4996F00BE32D6 /* Localizable.xcstrings */, F001A04A2DD48FAB00809561 /* App */, F001A05C2DD48FAE00809561 /* AppTests */, @@ -159,7 +162,7 @@ F0F59E4D2DD4986C00BE32D6 /* View */ = { isa = PBXGroup; children = ( - F001A04D2DD48FAB00809561 /* ContentView.swift */, + F001A04D2DD48FAB00809561 /* MainMenuView.swift */, ); path = View; sourceTree = ""; @@ -270,6 +273,7 @@ buildActionMask = 2147483647; files = ( F001A0542DD48FAD00809561 /* Preview Assets.xcassets in Resources */, + F0F59E512DD49C2800BE32D6 /* Colors.xcassets in Resources */, F001A0502DD48FAD00809561 /* Assets.xcassets in Resources */, F0F59E4F2DD4996F00BE32D6 /* Localizable.xcstrings in Resources */, ); @@ -296,7 +300,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - F001A04E2DD48FAB00809561 /* ContentView.swift in Sources */, + F001A04E2DD48FAB00809561 /* MainMenuView.swift in Sources */, F001A04C2DD48FAB00809561 /* AppApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/App/App/AppApp.swift b/App/App/AppApp.swift index 6159b87..abd1249 100644 --- a/App/App/AppApp.swift +++ b/App/App/AppApp.swift @@ -11,7 +11,7 @@ import SwiftUI struct AppApp: App { var body: some Scene { WindowGroup { - ContentView() + MainMenuView() } } } diff --git a/App/App/Localizable.xcstrings b/App/App/Localizable.xcstrings index fa3bf14..fe16ed7 100644 --- a/App/App/Localizable.xcstrings +++ b/App/App/Localizable.xcstrings @@ -1,7 +1,7 @@ { "sourceLanguage" : "en", "strings" : { - "genericAppName" : { + "appName" : { "extractionState" : "manual", "localizations" : { "en" : { @@ -17,6 +17,57 @@ } } } + }, + "appNameBannerTitle" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Connect 4!" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Puissance 4 !" + } + } + } + }, + "mainMenu.button.newGame" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "New Game" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Nouvelle partie" + } + } + } + }, + "mainMenu.button.scoreboard" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Scoreboard" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Tableau des scores" + } + } + } } }, "version" : "1.0" diff --git a/App/App/View/ContentView.swift b/App/App/View/ContentView.swift deleted file mode 100644 index 28b7901..0000000 --- a/App/App/View/ContentView.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// ContentView.swift -// App -// -// Created by etudiant2 on 14/05/2025. -// - -import SwiftUI - -struct ContentView: View { - var body: some View { - VStack { - Image(systemName: "globe") - .imageScale(.large) - .foregroundStyle(.tint) - Text(String(localized: "genericAppName")) - } - .padding() - } -} - -#Preview { - ContentView() -} diff --git a/App/App/View/MainMenuView.swift b/App/App/View/MainMenuView.swift new file mode 100644 index 0000000..14dda62 --- /dev/null +++ b/App/App/View/MainMenuView.swift @@ -0,0 +1,28 @@ +// +// ContentView.swift +// App +// +// Created by etudiant2 on 14/05/2025. +// + +import SwiftUI + +struct MainMenuView: View { + var body: some View { + VStack { + Label("appNameBannerTitle", systemImage: "globe") + + Button("mainMenu.button.newGame") { + // TODO + } + + Button("mainMenu.button.scoreboard") { + // TODO + } + } + } +} + +#Preview { + MainMenuView() +} diff --git a/App/Colors.xcassets/Contents.json b/App/Colors.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/App/Colors.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +}