merge dev_views_players 🔀

pull/13/head
Rayhân HASSOU 11 months ago
commit 002b3ec04a

@ -31,6 +31,9 @@
649B59AE2BF64EAB002BAE38 /* AppImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649B59AD2BF64EAB002BAE38 /* AppImages.swift */; };
649B59B22BF65392002BAE38 /* TextStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649B59B12BF65392002BAE38 /* TextStyles.swift */; };
649B59B42BF653E1002BAE38 /* ViewTitleTextStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649B59B32BF653E1002BAE38 /* ViewTitleTextStyle.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 */; };
EC62C4F92C0371660048CD0B /* MusicPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C4F82C0371660048CD0B /* MusicPlayer.swift */; };
EC62C4FB2C038BD20048CD0B /* PlayersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C4FA2C038BD20048CD0B /* PlayersView.swift */; };
EC62C4FD2C0391D30048CD0B /* PlayerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C4FC2C0391D30048CD0B /* PlayerRow.swift */; };
@ -40,7 +43,6 @@
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 */; };
EC62C5152C061C350048CD0B /* shrek.png in Resources */ = {isa = PBXBuildFile; fileRef = EC62C5142C061C350048CD0B /* shrek.png */; };
EC62C5172C0620C00048CD0B /* rap.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = EC62C5162C0620C00048CD0B /* rap.mp3 */; };
/* End PBXBuildFile section */
@ -103,6 +105,9 @@
649B59AD2BF64EAB002BAE38 /* AppImages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppImages.swift; sourceTree = "<group>"; };
649B59B12BF65392002BAE38 /* TextStyles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextStyles.swift; sourceTree = "<group>"; };
649B59B32BF653E1002BAE38 /* ViewTitleTextStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewTitleTextStyle.swift; sourceTree = "<group>"; };
64D992712C06281B002ACBC6 /* SystemIcons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemIcons.swift; sourceTree = "<group>"; };
EC05BFC32C04C3C4000F7B19 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
EC05BFC72C04D832000F7B19 /* CustomSwitchButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSwitchButton.swift; sourceTree = "<group>"; };
EC62C4F82C0371660048CD0B /* MusicPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MusicPlayer.swift; sourceTree = "<group>"; };
EC62C4FA2C038BD20048CD0B /* PlayersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayersView.swift; sourceTree = "<group>"; };
EC62C4FC2C0391D30048CD0B /* PlayerRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerRow.swift; sourceTree = "<group>"; };
@ -112,7 +117,6 @@
EC62C5082C0467240048CD0B /* SplashScreenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashScreenView.swift; sourceTree = "<group>"; };
EC62C50C2C046D9E0048CD0B /* SplashScreenSound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = SplashScreenSound.mp3; sourceTree = "<group>"; };
EC62C50E2C05D06A0048CD0B /* AddPlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddPlayerView.swift; sourceTree = "<group>"; };
EC62C5142C061C350048CD0B /* shrek.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = shrek.png; sourceTree = "<group>"; };
EC62C5162C0620C00048CD0B /* rap.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = rap.mp3; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -252,6 +256,7 @@
children = (
649ABF5A2BF60D78002E8894 /* MainMenuView.swift */,
EC62C5082C0467240048CD0B /* SplashScreenView.swift */,
EC05BFC32C04C3C4000F7B19 /* SettingsView.swift */,
);
path = Menu;
sourceTree = "<group>";
@ -269,6 +274,7 @@
649ABF5E2BF60ED5002E8894 /* Components */ = {
isa = PBXGroup;
children = (
EC05BFC62C04D7C2000F7B19 /* Settings */,
643AB6912BFCEFB70018DA73 /* Game */,
645B4C1C2BFCC95000FD658A /* Player */,
649ABF5F2BF60F2D002E8894 /* MainMenuButton.swift */,
@ -292,9 +298,9 @@
649B59AA2BF64DF1002BAE38 /* Images */ = {
isa = PBXGroup;
children = (
EC62C5142C061C350048CD0B /* shrek.png */,
649B59AB2BF64E12002BAE38 /* Images.xcassets */,
649B59AD2BF64EAB002BAE38 /* AppImages.swift */,
64D992712C06281B002ACBC6 /* SystemIcons.swift */,
);
path = Images;
sourceTree = "<group>";
@ -319,6 +325,14 @@
path = TextStyles;
sourceTree = "<group>";
};
EC05BFC62C04D7C2000F7B19 /* Settings */ = {
isa = PBXGroup;
children = (
EC05BFC72C04D832000F7B19 /* CustomSwitchButton.swift */,
);
path = Settings;
sourceTree = "<group>";
};
EC62C5022C045BB90048CD0B /* SoundPlayerClass */ = {
isa = PBXGroup;
children = (
@ -452,7 +466,6 @@
buildActionMask = 2147483647;
files = (
649B59A72BF64BA9002BAE38 /* Colors.xcassets in Resources */,
EC62C5152C061C350048CD0B /* shrek.png in Resources */,
6493C1C02C046BF900B5121D /* samurai.ttf in Resources */,
EC62C5062C045C1A0048CD0B /* TitleScreenButtonSound.mp3 in Resources */,
EC62C5172C0620C00048CD0B /* rap.mp3 in Resources */,
@ -485,12 +498,15 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EC05BFC42C04C3C4000F7B19 /* SettingsView.swift in Sources */,
643AB69B2BFCFB5C0018DA73 /* HistoricView.swift in Sources */,
EC62C50F2C05D06A0048CD0B /* AddPlayerView.swift in Sources */,
6458345E2BF5F92300E18321 /* ContentView.swift in Sources */,
649B59A92BF64C6A002BAE38 /* Colors.swift in Sources */,
649B59B42BF653E1002BAE38 /* ViewTitleTextStyle.swift in Sources */,
EC62C5012C045B590048CD0B /* SoundPlayer.swift in Sources */,
EC05BFC82C04D832000F7B19 /* CustomSwitchButton.swift in Sources */,
64D992722C06281B002ACBC6 /* SystemIcons.swift in Sources */,
645B4C252BFCD3C600FD658A /* ScoreBoardView.swift in Sources */,
649B59AE2BF64EAB002BAE38 /* AppImages.swift in Sources */,
649ABF602BF60F2D002E8894 /* MainMenuButton.swift in Sources */,

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 KiB

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

@ -40,6 +40,7 @@ struct MainMenuView: View {
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)
}
if let currentImage = currentImage {
Image(currentImage)

@ -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()
}
}
Loading…
Cancel
Save