diff --git a/DouShouQi_App/DouShouQi-App-Info.plist b/DouShouQi_App/DouShouQi-App-Info.plist index 0c67376..b31fd90 100644 --- a/DouShouQi_App/DouShouQi-App-Info.plist +++ b/DouShouQi_App/DouShouQi-App-Info.plist @@ -1,5 +1,10 @@ - + + UIAppFonts + + samurai.ttf + + diff --git a/DouShouQi_App/DouShouQi_App.xcodeproj/project.pbxproj b/DouShouQi_App/DouShouQi_App.xcodeproj/project.pbxproj index be3fb52..94ee32e 100644 --- a/DouShouQi_App/DouShouQi_App.xcodeproj/project.pbxproj +++ b/DouShouQi_App/DouShouQi_App.xcodeproj/project.pbxproj @@ -18,6 +18,13 @@ 645834892BF5FEA000E18321 /* DSQ.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 645834872BF5FEA000E18321 /* DSQ.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 649ABF5B2BF60D78002E8894 /* GameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649ABF5A2BF60D78002E8894 /* GameView.swift */; }; 649B59A42BF64574002BAE38 /* TopGameBoard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649B59A32BF64574002BAE38 /* TopGameBoard.swift */; }; + 645B4C202BFCCA0500FD658A /* PlayerResumeFrame.swift in Sources */ = {isa = PBXBuildFile; fileRef = 645B4C1F2BFCCA0500FD658A /* PlayerResumeFrame.swift */; }; + 645B4C252BFCD3C600FD658A /* ScoreBoardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 645B4C242BFCD3C600FD658A /* ScoreBoardView.swift */; }; + 6493C1C02C046BF900B5121D /* samurai.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6493C1BF2C046BF900B5121D /* samurai.ttf */; }; + 6493C1C22C046E5E00B5121D /* Fonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6493C1C12C046E5E00B5121D /* Fonts.swift */; }; + 649ABF5B2BF60D78002E8894 /* MainMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649ABF5A2BF60D78002E8894 /* MainMenuView.swift */; }; + 649ABF602BF60F2D002E8894 /* MainMenuButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649ABF5F2BF60F2D002E8894 /* MainMenuButton.swift */; }; + 649B59A42BF64574002BAE38 /* TitlePageFrame.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649B59A32BF64574002BAE38 /* TitlePageFrame.swift */; }; 649B59A72BF64BA9002BAE38 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 649B59A62BF64BA9002BAE38 /* Colors.xcassets */; }; 649B59A92BF64C6A002BAE38 /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649B59A82BF64C6A002BAE38 /* Colors.swift */; }; 649B59AC2BF64E12002BAE38 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 649B59AB2BF64E12002BAE38 /* Images.xcassets */; }; @@ -28,6 +35,17 @@ ECB6364E2C04628E007CD5E2 /* SpriteMeeple.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB6364D2C04628E007CD5E2 /* SpriteMeeple.swift */; }; ECB636512C046379007CD5E2 /* MusicPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB636502C046379007CD5E2 /* MusicPlayer.swift */; }; ECB636532C0463A9007CD5E2 /* SoundPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB636522C0463A9007CD5E2 /* SoundPlayer.swift */; }; + 64D992722C06281B002ACBC6 /* SystemIcons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64D992712C06281B002ACBC6 /* SystemIcons.swift */; }; + EC05BFC42C04C3C4000F7B19 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC05BFC32C04C3C4000F7B19 /* SettingsView.swift */; }; + EC05BFC82C04D832000F7B19 /* CustomSwitchButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC05BFC72C04D832000F7B19 /* CustomSwitchButton.swift */; }; + EC62C4FB2C038BD20048CD0B /* PlayersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C4FA2C038BD20048CD0B /* PlayersView.swift */; }; + EC62C4FD2C0391D30048CD0B /* PlayerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C4FC2C0391D30048CD0B /* PlayerRow.swift */; }; + EC62C4FF2C0457AD0048CD0B /* TitleScreenMusic.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = EC62C4FE2C0457AD0048CD0B /* TitleScreenMusic.mp3 */; }; + EC62C5062C045C1A0048CD0B /* TitleScreenButtonSound.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = EC62C5052C045C1A0048CD0B /* TitleScreenButtonSound.mp3 */; }; + EC62C5092C0467240048CD0B /* SplashScreenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C5082C0467240048CD0B /* SplashScreenView.swift */; }; + EC62C50D2C046D9E0048CD0B /* SplashScreenSound.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = EC62C50C2C046D9E0048CD0B /* SplashScreenSound.mp3 */; }; + EC62C50F2C05D06A0048CD0B /* AddPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C50E2C05D06A0048CD0B /* AddPlayerView.swift */; }; + EC62C5172C0620C00048CD0B /* rap.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = EC62C5162C0620C00048CD0B /* rap.mp3 */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -76,6 +94,13 @@ 645834872BF5FEA000E18321 /* DSQ.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = DSQ.xcframework; sourceTree = ""; }; 649ABF5A2BF60D78002E8894 /* GameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameView.swift; sourceTree = ""; }; 649B59A32BF64574002BAE38 /* TopGameBoard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopGameBoard.swift; sourceTree = ""; }; + 645B4C1F2BFCCA0500FD658A /* PlayerResumeFrame.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerResumeFrame.swift; sourceTree = ""; }; + 645B4C242BFCD3C600FD658A /* ScoreBoardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScoreBoardView.swift; sourceTree = ""; }; + 6493C1BF2C046BF900B5121D /* samurai.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = samurai.ttf; sourceTree = ""; }; + 6493C1C12C046E5E00B5121D /* Fonts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fonts.swift; sourceTree = ""; }; + 649ABF5A2BF60D78002E8894 /* MainMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuView.swift; sourceTree = ""; }; + 649ABF5F2BF60F2D002E8894 /* MainMenuButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuButton.swift; sourceTree = ""; }; + 649B59A32BF64574002BAE38 /* TitlePageFrame.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitlePageFrame.swift; sourceTree = ""; }; 649B59A62BF64BA9002BAE38 /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; 649B59A82BF64C6A002BAE38 /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = ""; }; 649B59AB2BF64E12002BAE38 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; @@ -86,6 +111,17 @@ ECB6364D2C04628E007CD5E2 /* SpriteMeeple.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpriteMeeple.swift; sourceTree = ""; }; ECB636502C046379007CD5E2 /* MusicPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MusicPlayer.swift; sourceTree = ""; }; ECB636522C0463A9007CD5E2 /* SoundPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoundPlayer.swift; sourceTree = ""; }; + 64D992712C06281B002ACBC6 /* SystemIcons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemIcons.swift; sourceTree = ""; }; + EC05BFC32C04C3C4000F7B19 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; + EC05BFC72C04D832000F7B19 /* CustomSwitchButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSwitchButton.swift; sourceTree = ""; }; + EC62C4FA2C038BD20048CD0B /* PlayersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayersView.swift; sourceTree = ""; }; + EC62C4FC2C0391D30048CD0B /* PlayerRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerRow.swift; sourceTree = ""; }; + EC62C4FE2C0457AD0048CD0B /* TitleScreenMusic.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = TitleScreenMusic.mp3; sourceTree = ""; }; + EC62C5052C045C1A0048CD0B /* TitleScreenButtonSound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = TitleScreenButtonSound.mp3; sourceTree = ""; }; + EC62C5082C0467240048CD0B /* SplashScreenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashScreenView.swift; sourceTree = ""; }; + EC62C50C2C046D9E0048CD0B /* SplashScreenSound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = SplashScreenSound.mp3; sourceTree = ""; }; + EC62C50E2C05D06A0048CD0B /* AddPlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddPlayerView.swift; sourceTree = ""; }; + EC62C5162C0620C00048CD0B /* rap.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = rap.mp3; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -114,6 +150,22 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 643AB6912BFCEFB70018DA73 /* Game */ = { + isa = PBXGroup; + children = ( + 643AB6922BFCEFD00018DA73 /* GameResumeFrame.swift */, + ); + path = Game; + sourceTree = ""; + }; + 643AB6992BFCFB480018DA73 /* Game */ = { + isa = PBXGroup; + children = ( + 643AB69A2BFCFB5C0018DA73 /* HistoricView.swift */, + ); + path = Game; + sourceTree = ""; + }; 6458344F2BF5F92300E18321 = { isa = PBXGroup; children = ( @@ -184,9 +236,41 @@ name = Frameworks; sourceTree = ""; }; + 645B4C1C2BFCC95000FD658A /* Player */ = { + isa = PBXGroup; + children = ( + 645B4C1F2BFCCA0500FD658A /* PlayerResumeFrame.swift */, + EC62C4FC2C0391D30048CD0B /* PlayerRow.swift */, + EC62C50E2C05D06A0048CD0B /* AddPlayerView.swift */, + ); + path = Player; + sourceTree = ""; + }; + 645B4C232BFCD39A00FD658A /* Player */ = { + isa = PBXGroup; + children = ( + 645B4C242BFCD3C600FD658A /* ScoreBoardView.swift */, + EC62C4FA2C038BD20048CD0B /* PlayersView.swift */, + ); + path = Player; + sourceTree = ""; + }; + 6493C1BE2C04650200B5121D /* Menu */ = { + isa = PBXGroup; + children = ( + 649ABF5A2BF60D78002E8894 /* MainMenuView.swift */, + EC62C5082C0467240048CD0B /* SplashScreenView.swift */, + EC05BFC32C04C3C4000F7B19 /* SettingsView.swift */, + ); + path = Menu; + sourceTree = ""; + }; 649ABF592BF60D13002E8894 /* Views */ = { isa = PBXGroup; children = ( + 643AB6992BFCFB480018DA73 /* Game */, + 645B4C232BFCD39A00FD658A /* Player */, + 6493C1BE2C04650200B5121D /* Menu */, EC05BFC92C05ECC6000F7B19 /* Scene */, 649ABF5A2BF60D78002E8894 /* GameView.swift */, ); @@ -197,6 +281,11 @@ isa = PBXGroup; children = ( 649B59A32BF64574002BAE38 /* TopGameBoard.swift */, + EC05BFC62C04D7C2000F7B19 /* Settings */, + 643AB6912BFCEFB70018DA73 /* Game */, + 645B4C1C2BFCC95000FD658A /* Player */, + 649ABF5F2BF60F2D002E8894 /* MainMenuButton.swift */, + 649B59A32BF64574002BAE38 /* TitlePageFrame.swift */, ); path = Components; sourceTree = ""; @@ -204,6 +293,8 @@ 649B59A52BF64B1B002BAE38 /* Assets */ = { isa = PBXGroup; children = ( + EC62C5042C045BE00048CD0B /* Musics */, + EC62C5032C045BD30048CD0B /* Sounds */, 649B59B02BF65360002BAE38 /* TextStyles */, 649B59AF2BF64F0A002BAE38 /* Colors */, 649B59AA2BF64DF1002BAE38 /* Images */, @@ -216,6 +307,7 @@ children = ( 649B59AB2BF64E12002BAE38 /* Images.xcassets */, 649B59AD2BF64EAB002BAE38 /* AppImages.swift */, + 64D992712C06281B002ACBC6 /* SystemIcons.swift */, ); path = Images; sourceTree = ""; @@ -232,12 +324,22 @@ 649B59B02BF65360002BAE38 /* TextStyles */ = { isa = PBXGroup; children = ( + 6493C1BF2C046BF900B5121D /* samurai.ttf */, 649B59B12BF65392002BAE38 /* TextStyles.swift */, 649B59B32BF653E1002BAE38 /* ViewTitleTextStyle.swift */, + 6493C1C12C046E5E00B5121D /* Fonts.swift */, ); path = TextStyles; sourceTree = ""; }; + EC05BFC62C04D7C2000F7B19 /* Settings */ = { + isa = PBXGroup; + children = ( + EC05BFC72C04D832000F7B19 /* CustomSwitchButton.swift */, + ); + path = Settings; + sourceTree = ""; + }; EC05BFC92C05ECC6000F7B19 /* Scene */ = { isa = PBXGroup; children = ( @@ -256,6 +358,24 @@ path = SoundPlayerClass; sourceTree = ""; }; + EC62C5032C045BD30048CD0B /* Sounds */ = { + isa = PBXGroup; + children = ( + EC62C50C2C046D9E0048CD0B /* SplashScreenSound.mp3 */, + EC62C5052C045C1A0048CD0B /* TitleScreenButtonSound.mp3 */, + ); + path = Sounds; + sourceTree = ""; + }; + EC62C5042C045BE00048CD0B /* Musics */ = { + isa = PBXGroup; + children = ( + EC62C5162C0620C00048CD0B /* rap.mp3 */, + EC62C4FE2C0457AD0048CD0B /* TitleScreenMusic.mp3 */, + ); + path = Musics; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -362,9 +482,14 @@ buildActionMask = 2147483647; files = ( 649B59A72BF64BA9002BAE38 /* Colors.xcassets in Resources */, + 6493C1C02C046BF900B5121D /* samurai.ttf in Resources */, + EC62C5062C045C1A0048CD0B /* TitleScreenButtonSound.mp3 in Resources */, + EC62C5172C0620C00048CD0B /* rap.mp3 in Resources */, 649B59AC2BF64E12002BAE38 /* Images.xcassets in Resources */, + EC62C50D2C046D9E0048CD0B /* SplashScreenSound.mp3 in Resources */, 645834632BF5F92500E18321 /* Preview Assets.xcassets in Resources */, 645834602BF5F92500E18321 /* Assets.xcassets in Resources */, + EC62C4FF2C0457AD0048CD0B /* TitleScreenMusic.mp3 in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -401,6 +526,21 @@ ECB636512C046379007CD5E2 /* MusicPlayer.swift in Sources */, ECB6364E2C04628E007CD5E2 /* SpriteMeeple.swift in Sources */, 649B59A42BF64574002BAE38 /* TopGameBoard.swift in Sources */, + EC05BFC42C04C3C4000F7B19 /* SettingsView.swift in Sources */, + 643AB69B2BFCFB5C0018DA73 /* HistoricView.swift in Sources */, + EC62C50F2C05D06A0048CD0B /* AddPlayerView.swift in Sources */, + EC05BFC82C04D832000F7B19 /* CustomSwitchButton.swift in Sources */, + 64D992722C06281B002ACBC6 /* SystemIcons.swift in Sources */, + 645B4C252BFCD3C600FD658A /* ScoreBoardView.swift in Sources */, + 649ABF602BF60F2D002E8894 /* MainMenuButton.swift in Sources */, + 643AB6932BFCEFD00018DA73 /* GameResumeFrame.swift in Sources */, + EC62C5092C0467240048CD0B /* SplashScreenView.swift in Sources */, + EC62C4FD2C0391D30048CD0B /* PlayerRow.swift in Sources */, + EC62C4FB2C038BD20048CD0B /* PlayersView.swift in Sources */, + 645B4C202BFCCA0500FD658A /* PlayerResumeFrame.swift in Sources */, + 649ABF5B2BF60D78002E8894 /* MainMenuView.swift in Sources */, + 6493C1C22C046E5E00B5121D /* Fonts.swift in Sources */, + 649B59A42BF64574002BAE38 /* TitlePageFrame.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.swift b/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.swift index a3b3cd9..33e70ff 100644 --- a/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.swift +++ b/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.swift @@ -12,4 +12,5 @@ public struct Colors { static let TitleText = Color("TitleTextColor") static let Button = Color("ButtonColor") static let MeepleP1 = UIColor(named: "MeepleP1") + static let TextButton = Color("ButtonTextColor") } diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/AppImages.swift b/DouShouQi_App/DouShouQi_App/Assets/Images/AppImages.swift index 5a70011..902a88f 100644 --- a/DouShouQi_App/DouShouQi_App/Assets/Images/AppImages.swift +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/AppImages.swift @@ -12,4 +12,11 @@ public struct AppImages { static let TitleImage = "TitlePageImage" static let SemiLion = "SemiLion" static let boardGame = "boardGame" + static let Lion = "Lion" + static let Rat = "Rat" + static let Elephant = "Elephant" + static let Cat = "Cat" + static let Dog = "Dog" + static let Leopard = "Leopard" + static let Wolf = "Wolf" } diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Cat.imageset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Cat.imageset/Contents.json new file mode 100644 index 0000000..cf9e340 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Cat.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "doushouqi-cat.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Cat.imageset/doushouqi-cat.svg b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Cat.imageset/doushouqi-cat.svg new file mode 100644 index 0000000..efbcb8b --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Cat.imageset/doushouqi-cat.svg @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Dog.imageset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Dog.imageset/Contents.json new file mode 100644 index 0000000..d18d976 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Dog.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "doushouqi-dog.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Dog.imageset/doushouqi-dog.svg b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Dog.imageset/doushouqi-dog.svg new file mode 100644 index 0000000..c19368b --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Dog.imageset/doushouqi-dog.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Elephant.imageset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Elephant.imageset/Contents.json new file mode 100644 index 0000000..7326d74 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Elephant.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "doushouqi-elephant.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Elephant.imageset/doushouqi-elephant.svg b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Elephant.imageset/doushouqi-elephant.svg new file mode 100644 index 0000000..fd7e877 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Elephant.imageset/doushouqi-elephant.svg @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Leopard.imageset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Leopard.imageset/Contents.json new file mode 100644 index 0000000..0a3aa08 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Leopard.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "doushouqi-leopard.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Leopard.imageset/doushouqi-leopard.svg b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Leopard.imageset/doushouqi-leopard.svg new file mode 100644 index 0000000..477b3f0 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Leopard.imageset/doushouqi-leopard.svg @@ -0,0 +1,442 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Lion.imageset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Lion.imageset/Contents.json new file mode 100644 index 0000000..f123ff0 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Lion.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "doushouqi-lion.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Lion.imageset/doushouqi-lion.svg b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Lion.imageset/doushouqi-lion.svg new file mode 100644 index 0000000..2bf2e5d --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Lion.imageset/doushouqi-lion.svg @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Rat.imageset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Rat.imageset/Contents.json new file mode 100644 index 0000000..7250ab4 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Rat.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "doushouqi-rat.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Rat.imageset/doushouqi-rat.svg b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Rat.imageset/doushouqi-rat.svg new file mode 100644 index 0000000..7cb8da0 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Rat.imageset/doushouqi-rat.svg @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Wolf.imageset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Wolf.imageset/Contents.json new file mode 100644 index 0000000..b9d1c0a --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Wolf.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "doushouqi-wolf.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Wolf.imageset/doushouqi-wolf.svg b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Wolf.imageset/doushouqi-wolf.svg new file mode 100644 index 0000000..ea28a01 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/Wolf.imageset/doushouqi-wolf.svg @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/SystemIcons.swift b/DouShouQi_App/DouShouQi_App/Assets/Images/SystemIcons.swift new file mode 100644 index 0000000..c948321 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/SystemIcons.swift @@ -0,0 +1,15 @@ +// +// SystemIcons.swift +// DouShouQi_App +// +// Created by Rémi REGNAULT on 28/05/2024. +// + +import Foundation + +public struct SystemIcons { + static let DarkTheme = "moon" + static let LightTheme = "sun.max" + static let SoundOn = "speaker.2" + static let SoundOff = "speaker.slash" +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Musique.xcassets/ScreenTitleMusique.dataset/ytmp3free.cc_1-a-o-t-2-main-theme-attack-on-titan-2-soundtrack-youtubemp3free.org.mp3 b/DouShouQi_App/DouShouQi_App/Assets/Musics/TitleScreenMusic.mp3 similarity index 100% rename from DouShouQi_App/DouShouQi_App/Assets/Musique.xcassets/ScreenTitleMusique.dataset/ytmp3free.cc_1-a-o-t-2-main-theme-attack-on-titan-2-soundtrack-youtubemp3free.org.mp3 rename to DouShouQi_App/DouShouQi_App/Assets/Musics/TitleScreenMusic.mp3 diff --git a/DouShouQi_App/DouShouQi_App/Assets/Musics/rap.mp3 b/DouShouQi_App/DouShouQi_App/Assets/Musics/rap.mp3 new file mode 100644 index 0000000..0b61f4f Binary files /dev/null and b/DouShouQi_App/DouShouQi_App/Assets/Musics/rap.mp3 differ diff --git a/DouShouQi_App/DouShouQi_App/Assets/AppMusic.swift b/DouShouQi_App/DouShouQi_App/Assets/Musique/AppMusic.swift similarity index 50% rename from DouShouQi_App/DouShouQi_App/Assets/AppMusic.swift rename to DouShouQi_App/DouShouQi_App/Assets/Musique/AppMusic.swift index f328ccf..0357b84 100644 --- a/DouShouQi_App/DouShouQi_App/Assets/AppMusic.swift +++ b/DouShouQi_App/DouShouQi_App/Assets/Musique/AppMusic.swift @@ -6,3 +6,9 @@ // import Foundation +import SwiftUI + +public struct AppMusic { + static let ScreenTitleMusic = "ScreenTitleMusique" + +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Musique.xcassets/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Musique/Musique.xcassets/Contents.json similarity index 100% rename from DouShouQi_App/DouShouQi_App/Assets/Musique.xcassets/Contents.json rename to DouShouQi_App/DouShouQi_App/Assets/Musique/Musique.xcassets/Contents.json diff --git a/DouShouQi_App/DouShouQi_App/Assets/Musique.xcassets/ScreenTitleMusique.dataset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Musique/Musique.xcassets/ScreenTitleMusique.dataset/Contents.json similarity index 100% rename from DouShouQi_App/DouShouQi_App/Assets/Musique.xcassets/ScreenTitleMusique.dataset/Contents.json rename to DouShouQi_App/DouShouQi_App/Assets/Musique/Musique.xcassets/ScreenTitleMusique.dataset/Contents.json diff --git a/DouShouQi_App/DouShouQi_App/Assets/Musique/Musique.xcassets/ScreenTitleMusique.dataset/ytmp3free.cc_1-a-o-t-2-main-theme-attack-on-titan-2-soundtrack-youtubemp3free.org.mp3 b/DouShouQi_App/DouShouQi_App/Assets/Musique/Musique.xcassets/ScreenTitleMusique.dataset/ytmp3free.cc_1-a-o-t-2-main-theme-attack-on-titan-2-soundtrack-youtubemp3free.org.mp3 new file mode 100644 index 0000000..3d9329c Binary files /dev/null and b/DouShouQi_App/DouShouQi_App/Assets/Musique/Musique.xcassets/ScreenTitleMusique.dataset/ytmp3free.cc_1-a-o-t-2-main-theme-attack-on-titan-2-soundtrack-youtubemp3free.org.mp3 differ diff --git a/DouShouQi_App/DouShouQi_App/Assets/Sounds/SplashScreenSound.mp3 b/DouShouQi_App/DouShouQi_App/Assets/Sounds/SplashScreenSound.mp3 new file mode 100644 index 0000000..9c5c9d1 Binary files /dev/null and b/DouShouQi_App/DouShouQi_App/Assets/Sounds/SplashScreenSound.mp3 differ diff --git a/DouShouQi_App/DouShouQi_App/Assets/Sounds/TitleScreenButtonSound.mp3 b/DouShouQi_App/DouShouQi_App/Assets/Sounds/TitleScreenButtonSound.mp3 new file mode 100644 index 0000000..91ec965 Binary files /dev/null and b/DouShouQi_App/DouShouQi_App/Assets/Sounds/TitleScreenButtonSound.mp3 differ diff --git a/DouShouQi_App/DouShouQi_App/Assets/TextStyles/Fonts.swift b/DouShouQi_App/DouShouQi_App/Assets/TextStyles/Fonts.swift new file mode 100644 index 0000000..56f2dbf --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/TextStyles/Fonts.swift @@ -0,0 +1,12 @@ +// +// Fonts.swift +// DouShouQi_App +// +// Created by Rémi REGNAULT on 27/05/2024. +// + +import Foundation + +public struct Fonts { + static let title = "samurai" +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/TextStyles/TextStyles.swift b/DouShouQi_App/DouShouQi_App/Assets/TextStyles/TextStyles.swift index 59d5d13..8fd71f8 100644 --- a/DouShouQi_App/DouShouQi_App/Assets/TextStyles/TextStyles.swift +++ b/DouShouQi_App/DouShouQi_App/Assets/TextStyles/TextStyles.swift @@ -8,14 +8,14 @@ import Foundation import SwiftUI -protocol TextStyle: ViewModifier {} +protocol TextStyles: ViewModifier {} extension Text { - func textStyle(T: any TextStyle) { - modifier(T) + func textStyle(_ style: T) -> some View { + modifier(style) } } -struct TextStyles { - static let ViewTitle = ViewTitleTextStyle() +struct CustomTextStyles { + static let Title = ViewTitleTextStyle() } diff --git a/DouShouQi_App/DouShouQi_App/Assets/TextStyles/ViewTitleTextStyle.swift b/DouShouQi_App/DouShouQi_App/Assets/TextStyles/ViewTitleTextStyle.swift index 4e1c641..602bb67 100644 --- a/DouShouQi_App/DouShouQi_App/Assets/TextStyles/ViewTitleTextStyle.swift +++ b/DouShouQi_App/DouShouQi_App/Assets/TextStyles/ViewTitleTextStyle.swift @@ -8,10 +8,11 @@ import Foundation import SwiftUI -struct ViewTitleTextStyle: TextStyle { +struct ViewTitleTextStyle: TextStyles { func body(content: Content) -> some View { content .foregroundColor(Colors.TitleText) .fontWeight(.bold) + .font(.custom(Fonts.title, size: 30)) } } diff --git a/DouShouQi_App/DouShouQi_App/Assets/TextStyles/samurai.ttf b/DouShouQi_App/DouShouQi_App/Assets/TextStyles/samurai.ttf new file mode 100644 index 0000000..5de690c Binary files /dev/null and b/DouShouQi_App/DouShouQi_App/Assets/TextStyles/samurai.ttf differ diff --git a/DouShouQi_App/DouShouQi_App/Assets/TitleScreenMusic.mp3 b/DouShouQi_App/DouShouQi_App/Assets/TitleScreenMusic.mp3 new file mode 100644 index 0000000..3d9329c Binary files /dev/null and b/DouShouQi_App/DouShouQi_App/Assets/TitleScreenMusic.mp3 differ diff --git a/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift b/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift index e8609f2..b421b74 100644 --- a/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift +++ b/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift @@ -7,16 +7,25 @@ import SwiftUI -struct MainMenuButton: View { +struct MainMenuButton: View { // Text Params var text: String - @State private var isHovered: Bool = false + var destination: Destination + var sound: String + + + // Button Alignment + var horizontalAlignment: Alignment = .center + + // Button corner radius + var topLeftCorner: CGFloat = 0 + var topRightCorner: CGFloat = 0 + var bottomLeftCorner: CGFloat = 0 + var bottomRightCorner: CGFloat = 0 var body: some View { - Button(action: { - // Action du bouton - }, label: { + NavigationLink(destination: destination) { Text(text.uppercased()) .font(.headline) .fontWeight(.semibold) @@ -24,18 +33,16 @@ struct MainMenuButton: View { .padding() .frame(maxWidth: .infinity, maxHeight: 40) .background( - Colors.Button + Color.red .clipShape(RoundedRectangle(cornerSize: CGSize(width: 0, height: 0))) - .mask(RoundedCornersShape(cornerRadii: (topLeft: 0, topRight: 10, bottomLeft: 0, bottomRight: 10))) + .mask(RoundedCornersShape(cornerRadii: (topLeft: topLeftCorner, topRight: topRightCorner, bottomLeft: bottomLeftCorner, bottomRight: bottomRightCorner))) ) + } + .simultaneousGesture(TapGesture().onEnded { + playSound(named: sound) }) .frame(width: UIScreen.main.bounds.width / 1.7) - .frame(maxWidth: .infinity, alignment: .leading) - .scaleEffect(isHovered ? 1.1 : 1.0) - .animation(.easeInOut(duration: 0.2), value: isHovered) - .onHover { hovering in - self.isHovered = hovering - } + .frame(maxWidth: .infinity, alignment: horizontalAlignment) } } @@ -85,6 +92,6 @@ struct RoundedCornersShape: Shape { struct MainMenuButton_Previews: PreviewProvider { static var previews: some View { - MainMenuButton(text: "test") + MainMenuButton(text: "test", destination: HistoricView(), sound: "TitleScreenButtonSound", horizontalAlignment: .leading, topRightCorner: 10, bottomRightCorner: 10) } } diff --git a/DouShouQi_App/DouShouQi_App/Components/Player/AddPlayerView.swift b/DouShouQi_App/DouShouQi_App/Components/Player/AddPlayerView.swift new file mode 100644 index 0000000..49680b1 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Components/Player/AddPlayerView.swift @@ -0,0 +1,150 @@ +// +// AddPlayerView.swift +// DouShouQi_App +// +// Created by étudiant on 28/05/2024. +// + +import SwiftUI +import UIKit + +struct AddPlayerView: View { + @Binding var isPresented: Bool + @Binding var players: [Player] + @State private var playerName: String = "" + @State private var showAlert = false + @State private var showImagePicker = false + @State private var profileImage: UIImage? = nil + @State private var profileImagePath: String = "" + @State private var imagePickerSourceType: UIImagePickerController.SourceType = .photoLibrary + @State private var showActionSheet = false + + var body: some View { + VStack(spacing: 20) { + Text("Add New Player") + .font(.headline) + + TextField("Player Name", text: $playerName) + .padding() + .background(Color(.systemGray6)) + .cornerRadius(10) + + if let profileImage = profileImage { + Image(uiImage: profileImage) + .resizable() + .frame(width: 100, height: 100) + .clipShape(Circle()) + } else { + Button(action: { + showActionSheet = true + }) { + Text("Select Profile Photo") + .foregroundColor(.white) + .padding() + .background(Color.blue) + .cornerRadius(10) + } + } + + HStack { + Button(action: { + if players.contains(where: { $0.name.lowercased() == playerName.lowercased() }) { + showAlert = true + } else { + if let image = profileImage, let imageData = image.jpegData(compressionQuality: 0.8) { + let filename = UUID().uuidString + ".jpg" + let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) + let documentsDirectory = paths[0] + let fileURL = documentsDirectory.appendingPathComponent(filename) + try? imageData.write(to: fileURL) + profileImagePath = fileURL.path + } + let newPlayer = Player(name: playerName, wins: 0, losses: 0, photo: profileImagePath) + players.append(newPlayer) + isPresented = false + } + }) { + Text("Add") + .foregroundColor(.white) + .padding() + .background(Color.blue) + .cornerRadius(10) + } + + Button(action: { + isPresented = false + }) { + Text("Cancel") + .foregroundColor(.white) + .padding() + .background(Color.red) + .cornerRadius(10) + } + } + } + .padding() + .frame(maxWidth: 300) + .background(Color.white) + .cornerRadius(20) + .shadow(radius: 10) + .alert(isPresented: $showAlert) { + Alert(title: Text("Error"), message: Text("Player already exists."), dismissButton: .default(Text("OK"))) + } + .actionSheet(isPresented: $showActionSheet) { + ActionSheet(title: Text("Select Photo"), message: Text("Choose a photo from the library or take a new one."), buttons: [ + .default(Text("Photo Library")) { + imagePickerSourceType = .photoLibrary + showImagePicker = true + }, + .default(Text("Camera")) { + imagePickerSourceType = .camera + showImagePicker = true + }, + .cancel() + ]) + } + .sheet(isPresented: $showImagePicker) { + ImagePicker(image: $profileImage, sourceType: imagePickerSourceType) + } + } +} + +struct ImagePicker: UIViewControllerRepresentable { + @Binding var image: UIImage? + var sourceType: UIImagePickerController.SourceType + + class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate { + var parent: ImagePicker + + init(parent: ImagePicker) { + self.parent = parent + } + + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { + if let uiImage = info[.originalImage] as? UIImage { + parent.image = uiImage + } + + parent.presentationMode.wrappedValue.dismiss() + } + + func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { + parent.presentationMode.wrappedValue.dismiss() + } + } + + func makeCoordinator() -> Coordinator { + Coordinator(parent: self) + } + + @Environment(\.presentationMode) var presentationMode + + func makeUIViewController(context: Context) -> UIImagePickerController { + let picker = UIImagePickerController() + picker.delegate = context.coordinator + picker.sourceType = sourceType + return picker + } + + func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) {} +} diff --git a/DouShouQi_App/DouShouQi_App/Components/Player/PlayerRow.swift b/DouShouQi_App/DouShouQi_App/Components/Player/PlayerRow.swift new file mode 100644 index 0000000..b8acb4e --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Components/Player/PlayerRow.swift @@ -0,0 +1,57 @@ +// +// PlayerRow.swift +// DouShouQi_App +// +// Created by étudiant on 26/05/2024. +// + +import Foundation +import SwiftUI + +struct PlayerRow: View { + var player: Player + @Binding var players: [Player] + + var body: some View { + HStack { + if let image = UIImage(contentsOfFile: player.photo) { + Image(uiImage: image) + .resizable() + .frame(width: 50, height: 50) + .clipShape(Circle()) + } else { + Image(systemName: "person.circle.fill") + .resizable() + .frame(width: 50, height: 50) + .clipShape(Circle()) + .foregroundColor(.gray) + } + + VStack(alignment: .leading) { + Text(player.name) + .font(.headline) + Text("Victoires : \(player.wins) Défaites : \(player.losses)") + .font(.subheadline) + } + Spacer() + Button(action: { + // Action pour éditer le joueur + }) { + Image(systemName: "pencil") + .foregroundColor(.black) + } + Button(action: { + + }) { + Image(systemName: "trash") + .foregroundColor(.red) + } + } + .padding() + .background(Color.white) + .cornerRadius(10) + .shadow(radius: 1) + } +} + + diff --git a/DouShouQi_App/DouShouQi_App/Components/Settings/CustomSwitchButton.swift b/DouShouQi_App/DouShouQi_App/Components/Settings/CustomSwitchButton.swift new file mode 100644 index 0000000..560ffd9 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Components/Settings/CustomSwitchButton.swift @@ -0,0 +1,56 @@ +// +// CustomSwitchButton.swift +// DouShouQi_App +// +// Created by etudiant on 27/05/2024. +// + +import SwiftUI + +struct CustomSwitchButton: View { + + // Boolean + @Binding var IsOn: Bool + + // Image when Off + var imgSystemNameIsOff: String + var imgIsOffWidth: CGFloat = 25 + var imgIsOffHeight: CGFloat = 25 + + // Image when Off + var imgSystemNameIsOn: String + var imgIsOnWidth: CGFloat = 25 + var imgIsOnHeight: CGFloat = 25 + + var body: some View { + HStack { + VStack { + if (!IsOn) { + Image(systemName: imgSystemNameIsOff) + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: imgIsOffWidth, height: imgIsOffHeight) + } + }.frame(width: imgIsOffWidth, height: imgIsOffHeight) + + Toggle("isOn", isOn: $IsOn) + .labelsHidden() + + VStack { + if (IsOn) { + Image(systemName: imgSystemNameIsOn) + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: imgIsOnWidth, height: imgIsOnHeight) + } + }.frame(width: imgIsOffWidth, height: imgIsOffHeight) + } + } +} + +//struct CustomSwitchButton_Previews: PreviewProvider { +// static var previews: some View { +// @State var isOn: Bool = false +// CustomSwitchButton(IsOn: $isOn, imgNameIsOff: AppImages.TitleImage, imgNameIsOn: AppImages.TitleImage) +// } +//} diff --git a/DouShouQi_App/DouShouQi_App/Components/TitlePageFrame.swift b/DouShouQi_App/DouShouQi_App/Components/TitlePageFrame.swift new file mode 100644 index 0000000..5346fe0 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Components/TitlePageFrame.swift @@ -0,0 +1,39 @@ +// +// TitlePageFrame.swift +// DouShouQi_App +// +// Created by Rémi REGNAULT on 16/05/2024. +// + +import SwiftUI + +struct TitlePageFrame: View { + + // Text Params + var Text: String + + // Image Params + var ImageWidth: CGFloat = 200 + var ImageHeight: CGFloat = 200 + + var body: some View { + VStack(alignment: .leading) { + ZStack { + Image(AppImages.TitleImage) + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: ImageWidth, height: ImageHeight) + + SwiftUI.Text(self.Text) + .textStyle(CustomTextStyles.Title) + + } + } + } +} + +struct TitlePageFrame_Previews: PreviewProvider { + static var previews: some View { + TitlePageFrame(Text: "DouShouQi") + } +} diff --git a/DouShouQi_App/DouShouQi_App/DouShouQi_AppApp.swift b/DouShouQi_App/DouShouQi_App/DouShouQi_AppApp.swift index c341ba1..f2d4e8d 100644 --- a/DouShouQi_App/DouShouQi_App/DouShouQi_AppApp.swift +++ b/DouShouQi_App/DouShouQi_App/DouShouQi_AppApp.swift @@ -7,11 +7,12 @@ import SwiftUI + @main struct DouShouQi_AppApp: App { var body: some Scene { WindowGroup { - ContentView() + MainMenuView() } } } diff --git a/DouShouQi_App/DouShouQi_App/MusicPlayer.swift b/DouShouQi_App/DouShouQi_App/MusicPlayer.swift deleted file mode 100644 index eba2b45..0000000 --- a/DouShouQi_App/DouShouQi_App/MusicPlayer.swift +++ /dev/null @@ -1,8 +0,0 @@ -// -// MusicPlayer.swift -// DouShouQi_App -// -// Created by étudiant on 26/05/2024. -// - -import Foundation diff --git a/DouShouQi_App/DouShouQi_App/Views/Game/SwiftUIView.swift b/DouShouQi_App/DouShouQi_App/Views/Game/SwiftUIView.swift deleted file mode 100644 index e544d48..0000000 --- a/DouShouQi_App/DouShouQi_App/Views/Game/SwiftUIView.swift +++ /dev/null @@ -1,98 +0,0 @@ -// -// SwiftUIView.swift -// DouShouQi_App -// -// Created by étudiant on 22/05/2024. -// - -import SwiftUI - -struct SwiftUIView: View { - var body: some View { - VStack { - TitlePageFrame(Text: "DOU SHOU QI", ImageWidth: 200, ImageHeight: 200) - Spacer() - - VStack { - HStack{ - VStack { - Button(action: { - // Action du bouton - }, label: { - Text("Play".uppercased()) - .font(.headline) - .fontWeight(.semibold) - .foregroundColor(.white) - .frame(maxWidth: .infinity, maxHeight: 50) - .background( - Color.red - ) - .cornerRadius(0) - }) - .frame(width: UIScreen.main.bounds.width / 1.7) - .frame(maxWidth: .infinity, alignment: .leading) - - Button(action: { - // Action du bouton - }, label: { - Text("Historique".uppercased()) - .font(.headline) - .fontWeight(.semibold) - .foregroundColor(.white) - .frame(maxWidth: .infinity, maxHeight: 50) - .background( - Color.red - ) - .cornerRadius(0) - }) - .frame(width: UIScreen.main.bounds.width / 1.7) - .frame(maxWidth: .infinity, alignment: .leading) - - Button(action: { - // Action du bouton - }, label: { - Text("Best scores".uppercased()) - .font(.headline) - .fontWeight(.semibold) - .foregroundColor(.white) - .frame(maxWidth: .infinity, maxHeight: 50) - .background( - Color.red - ) - .cornerRadius(0) - }) - .frame(width: UIScreen.main.bounds.width / 1.7) - .frame(maxWidth: .infinity, alignment: .leading) - - Button(action: { - // Action du bouton - }, label: { - Text("Players".uppercased()) - .font(.headline) - .fontWeight(.semibold) - .foregroundColor(.white) - .frame(maxWidth: .infinity, maxHeight: 50) - .background( - Color.red - ) - .cornerRadius(0) - }) - .frame(width: UIScreen.main.bounds.width / 1.7) - .frame(maxWidth: .infinity, alignment: .leading) - } - .padding() - } - } - .padding(.horizontal, 10) - - Spacer() - } - } -} - - -struct SwiftUIView_Previews: PreviewProvider { - static var previews: some View { - SwiftUIView() - } -} diff --git a/DouShouQi_App/DouShouQi_App/Views/Menu/MainMenuView.swift b/DouShouQi_App/DouShouQi_App/Views/Menu/MainMenuView.swift new file mode 100644 index 0000000..57d1be8 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Views/Menu/MainMenuView.swift @@ -0,0 +1,84 @@ +// +// MainMenuView.swift +// DouShouQi_App +// +// Created by Rémi REGNAULT on 16/05/2024. +// + +import SwiftUI + +struct MainMenuView: View { + + @State private var showSplash = true + + var body: some View { + NavigationView { + VStack { + if showSplash { + SplashScreenView() + .transition(.opacity) + .animation(.easeOut(duration: 3), value: showSplash) + .onAppear { + DispatchQueue.main.asyncAfter(deadline: .now() + 8) { + withAnimation { + showSplash = false + } + } + } + } else { + TitlePageFrame(Text: "DOU SHOU QI", ImageWidth: 200, ImageHeight: 200) + Spacer() + + VStack { + HStack { + VStack(spacing: 25) { + MainMenuButton(text: "Play", destination: ScoreBoardView(), sound: "TitleScreenButtonSound", topRightCorner: 10, bottomRightCorner: 10) + MainMenuButton(text: "Historique", destination: HistoricView(), sound: "TitleScreenButtonSound", topRightCorner: 10, bottomRightCorner: 10) + MainMenuButton(text: "Best Scores", destination: ScoreBoardView(), sound: "TitleScreenButtonSound", topRightCorner: 10, bottomRightCorner: 10) + MainMenuButton(text: "Players", destination: PlayersView(), sound: "TitleScreenButtonSound", topRightCorner: 10, bottomRightCorner: 10) + MainMenuButton(text: "Settings", destination: SettingsView(), sound: "TitleScreenButtonSound", topRightCorner: 10, bottomRightCorner: 10) + } + Image(AppImages.SemiLion) + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 200, height: 500) + } + } + Spacer() + HStack { + Text("Copyright @") + .font(.headline) + .frame(alignment: .trailing) + + Text("Dou Shou Qi Team") + + Spacer() + + Text("2024") + .frame(alignment: .trailing) + } + .padding() + .background(Color.white) + .overlay( + Rectangle() + .stroke(Color.black, lineWidth: 1) + ) + + Spacer() + .onAppear { + MusicPlayer.shared.playBackgroundMusic(music: "TitleScreenMusic") + } + .onDisappear { + MusicPlayer.shared.stopBackgroundMusic() + } + } + } + } + } +} + +struct MainMenuView_Previews: PreviewProvider { + static var previews: some View { + MainMenuView() + } +} diff --git a/DouShouQi_App/DouShouQi_App/Views/Menu/SettingsView.swift b/DouShouQi_App/DouShouQi_App/Views/Menu/SettingsView.swift new file mode 100644 index 0000000..dcdb387 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Views/Menu/SettingsView.swift @@ -0,0 +1,76 @@ +// +// SettingsView.swift +// DouShouQi_App +// +// Created by etudiant on 27/05/2024. +// + +import SwiftUI + +extension String : Identifiable { + public var id: Self { return self } +} + +struct SettingsView: View { + + @State private var theme = false + @State private var choice = "English" + @State private var sound = true + + var body: some View { + VStack { + TitlePageFrame(Text: "Settings") + + VStack { + Divider() + + HStack { + Text("Theme") + .font(.headline) + + Spacer() + + CustomSwitchButton(IsOn: $theme, imgSystemNameIsOff: SystemIcons.LightTheme, imgSystemNameIsOn: SystemIcons.DarkTheme) + } + + Divider() + + HStack { + Text("Language") + .font(.headline) + + Spacer() + + Picker("Sort", selection: $choice) { + ForEach(["English", "Français", "Español"]) { + Text($0) + } + } + .pickerStyle(.menu) + } + + Divider() + + HStack { + Text("Theme") + .font(.headline) + + Spacer() + + CustomSwitchButton(IsOn: $sound, imgSystemNameIsOff: SystemIcons.SoundOff, imgSystemNameIsOn: SystemIcons.SoundOn) + } + + Divider() + } + .padding(20) + + Spacer() + } + } +} + +struct SettingsView_Previews: PreviewProvider { + static var previews: some View { + SettingsView() + } +} diff --git a/DouShouQi_App/DouShouQi_App/Views/Menu/SplashScreenView.swift b/DouShouQi_App/DouShouQi_App/Views/Menu/SplashScreenView.swift new file mode 100644 index 0000000..50919d1 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Views/Menu/SplashScreenView.swift @@ -0,0 +1,23 @@ +// +// SplashScreenView.swift +// DouShouQi_App +// +// Created by étudiant on 27/05/2024. +// + +import SwiftUI + +struct SplashScreenView: View { + var body: some View { + TitlePageFrame(Text: "DOU SHOU QI", ImageWidth: 200, ImageHeight: 200) + .onAppear { + playSound(named: "SplashScreenSound") + } + } +} + +struct SplashScreenView_Previews: PreviewProvider { + static var previews: some View { + SplashScreenView() + } +} diff --git a/DouShouQi_App/DouShouQi_App/Views/Player/PlayersView.swift b/DouShouQi_App/DouShouQi_App/Views/Player/PlayersView.swift new file mode 100644 index 0000000..3ae9046 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Views/Player/PlayersView.swift @@ -0,0 +1,124 @@ +// +// PlayersView.swift +// DouShouQi_App +// +// Created by étudiant on 26/05/2024. +// + +import Foundation +import SwiftUI + +// Modèle de données pour un joueur +struct Player: Identifiable { + var id = UUID() + var name: String + var wins: Int + var losses: Int + var photo: String +} + +// Exemple de vue pour l'interface utilisateur des joueurs +struct PlayersView: View { + // Liste de joueurs pour l'exemple + @State private var players = [ + Player(name: "Rayhan", wins: 7, losses: 6, photo: "shrek"), + Player(name: "Remi", wins: 7, losses: 2, photo: "shrek"), + Player(name: "Nathan", wins: 14, losses: 5, photo: "shrek") + ] + + @State private var searchText = "" + @State private var showingPopup = false + @State private var newPlayerName = "" + + var filteredPlayers: [Player] { + if searchText.isEmpty { + return players + } else { + return players.filter { $0.name.lowercased().contains(searchText.lowercased()) } + } + } + + var body: some View { + NavigationView { + VStack { + + TitlePageFrame(Text: "PLAYERS", ImageWidth: 200, ImageHeight: 200) + + + SearchBar(text: $searchText) + .padding(.horizontal) + + List { + ForEach(groupedPlayers.keys.sorted(), id: \.self) { key in + Section(header: Text(key)) { + ForEach(groupedPlayers[key]!) { player in + PlayerRow(player: player, players: $players) + } + } + } + } + + Button(action: { + showingPopup = true + }) { + Text("Add a player") + .font(.headline) + .foregroundColor(.white) + .padding() + .frame(maxWidth: .infinity) + .background(Color.red) + .cornerRadius(10) + .padding(.horizontal) + } + .padding(.bottom) + .sheet(isPresented: $showingPopup) { + AddPlayerView(isPresented: $showingPopup, players: $players) + } + } + } + } + + var groupedPlayers: [String: [Player]] { + Dictionary(grouping: filteredPlayers) { player in + String(player.name.prefix(1)).uppercased() + } + } +} + +// Vue pour la barre de recherche +struct SearchBar: UIViewRepresentable { + @Binding var text: String + + class Coordinator: NSObject, UISearchBarDelegate { + @Binding var text: String + + init(text: Binding) { + _text = text + } + + func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { + text = searchText + } + } + + func makeCoordinator() -> Coordinator { + return Coordinator(text: $text) + } + + func makeUIView(context: Context) -> UISearchBar { + let searchBar = UISearchBar(frame: .zero) + searchBar.delegate = context.coordinator + return searchBar + } + + func updateUIView(_ uiView: UISearchBar, context: Context) { + uiView.text = text + } +} + + +struct PlayersPageView_Previews: PreviewProvider { + static var previews: some View { + PlayersView() + } +}