Add a ProfileEditComponent

pull/22/head
Johan LACHENAL 11 months ago
parent 8aac942df7
commit c56dc05f3a

BIN
.DS_Store vendored

Binary file not shown.

@ -27,6 +27,7 @@
C24659E92BF60FAA004E80D5 /* ButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */; }; C24659E92BF60FAA004E80D5 /* ButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */; };
C24DAB5C2C061DC700681CD0 /* AI.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24DAB5B2C061DC700681CD0 /* AI.swift */; }; C24DAB5C2C061DC700681CD0 /* AI.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24DAB5B2C061DC700681CD0 /* AI.swift */; };
C24DAB5E2C061E3A00681CD0 /* Language.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24DAB5D2C061E3A00681CD0 /* Language.swift */; }; C24DAB5E2C061E3A00681CD0 /* Language.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24DAB5D2C061E3A00681CD0 /* Language.swift */; };
C24DAB622C062DBC00681CD0 /* ProfileEdit.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24DAB612C062DBC00681CD0 /* ProfileEdit.swift */; };
C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */; }; C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */; };
C25220F32C00AF490026B71F /* EditComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25220F22C00AF490026B71F /* EditComponent.swift */; }; C25220F32C00AF490026B71F /* EditComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25220F22C00AF490026B71F /* EditComponent.swift */; };
C2F394082C0462400070B4F6 /* PhotoButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */; }; C2F394082C0462400070B4F6 /* PhotoButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */; };
@ -74,6 +75,7 @@
C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonComponent.swift; sourceTree = "<group>"; }; C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonComponent.swift; sourceTree = "<group>"; };
C24DAB5B2C061DC700681CD0 /* AI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AI.swift; sourceTree = "<group>"; }; C24DAB5B2C061DC700681CD0 /* AI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AI.swift; sourceTree = "<group>"; };
C24DAB5D2C061E3A00681CD0 /* Language.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Language.swift; sourceTree = "<group>"; }; C24DAB5D2C061E3A00681CD0 /* Language.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Language.swift; sourceTree = "<group>"; };
C24DAB612C062DBC00681CD0 /* ProfileEdit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileEdit.swift; sourceTree = "<group>"; };
C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameParametersMenuView.swift; sourceTree = "<group>"; }; C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameParametersMenuView.swift; sourceTree = "<group>"; };
C25220F22C00AF490026B71F /* EditComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditComponent.swift; sourceTree = "<group>"; }; C25220F22C00AF490026B71F /* EditComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditComponent.swift; sourceTree = "<group>"; };
C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoButtonComponent.swift; sourceTree = "<group>"; }; C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoButtonComponent.swift; sourceTree = "<group>"; };
@ -262,6 +264,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */, C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */,
C24DAB612C062DBC00681CD0 /* ProfileEdit.swift */,
); );
path = Visuals; path = Visuals;
sourceTree = "<group>"; sourceTree = "<group>";
@ -415,6 +418,7 @@
82CE59EB2C045E3800ADEE24 /* GameView.swift in Sources */, 82CE59EB2C045E3800ADEE24 /* GameView.swift in Sources */,
C20310DA2BFCC8600031657D /* ToggleComponent.swift in Sources */, C20310DA2BFCC8600031657D /* ToggleComponent.swift in Sources */,
C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */, C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */,
C24DAB622C062DBC00681CD0 /* ProfileEdit.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

@ -1,6 +1,7 @@
{ {
"images" : [ "images" : [
{ {
"filename" : "Unknown.jpeg",
"idiom" : "universal", "idiom" : "universal",
"scale" : "1x" "scale" : "1x"
}, },

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

@ -9,12 +9,15 @@ import SwiftUI
struct EditComponent: View { struct EditComponent: View {
let explanation : String let explanation : String
let value : String @State private var name : String
@State private var name = "Joueur 1" init(explanation: String, value: String) {
self.explanation = explanation
self.name = value
}
var body: some View { var body: some View {
Form { Form {
Section(header : Text(explanation)) { Section(header : Text(explanation)) {
TextField(value, text : $name) TextField(name, text : $name)
} }
} }
} }
@ -22,6 +25,6 @@ struct EditComponent: View {
struct EditComponent_Previews: PreviewProvider { struct EditComponent_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
EditComponent(explanation: "Nom du joueur 1", value : "Joueur 1") EditComponent(explanation: "Nom du Joueur 1", value: "Joueur 1")
} }
} }

@ -8,13 +8,41 @@
import SwiftUI import SwiftUI
struct ProfileComponent: View { struct ProfileComponent: View {
let imageName: String
let color : Color
let profileWidth : CGFloat
let profileHeight : CGFloat
var body: some View { var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) GeometryReader { geometry in
ZStack {
// Background color
color
// Profile Image
Image(imageName)
.resizable()
.scaledToFill()
.clipShape(Circle())
.frame(width: geometry.size.width * 0.9, height: geometry.size.height * 0.95) // Smaller than the ZStack
}
// Ensure the ZStack takes the size of the GeometryReader
.frame(width: geometry.size.width, height: geometry.size.height)
.clipShape(Circle())
}
.aspectRatio(1, contentMode: .fit)
.frame(width: profileWidth, height: profileHeight) // Optional fixed size
} }
} }
struct ProfileComponent_Previews: PreviewProvider { struct ProfileComponent_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
ProfileComponent() ProfileComponent(
imageName: "profil",
color: Color(.red),
profileWidth: 200,
profileHeight : 200
)
.previewLayout(.sizeThatFits)
.padding()
} }
} }

@ -0,0 +1,27 @@
//
// ProfileEdit.swift
// ArkitDoushiQi
//
// Created by Johan LACHENAL on 28/05/2024.
//
import SwiftUI
struct ProfileEdit: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
struct ProfileEdit_Previews: PreviewProvider {
static var previews: some View {
VStack {
ProfileComponent(imageName: "profil", color: Color(.red), profileWidth: 100, profileHeight: 100)
VStack(alignment: .trailing) {
HStack {
EditComponent(explanation: "Nom du Joueur 1", value: "Joueur 1")
}
}
}
}
}

@ -37,8 +37,20 @@ struct GameParametersMenuView: View {
PickerComponent(title: "Sélectionne une IA :", PickerComponent(title: "Sélectionne une IA :",
selectedOption: $selectedAIOption, selectedOption: $selectedAIOption,
options: AIT.allCases) options: AIT.allCases)
EditComponent(explanation: "Nom du joueur 1", value: "Joueur 1") ProfileComponent(
EditComponent(explanation: "Nom du joueur 2",value: "Joueur 2") imageName: "profil",
color: Color(.red),
profileWidth: 100,
profileHeight : 100
)
EditComponent(explanation: "Nom du joueur 1", value: "Joueur 1").frame(width: .infinity,height: 100)
ProfileComponent(
imageName: "profil",
color: Color(.red),
profileWidth: 100,
profileHeight : 100
)
EditComponent(explanation: "Nom du joueur 2",value: "Joueur 2").frame(width: .infinity,height: 100)
ButtonComponent(title: "Lancer la partie") { ButtonComponent(title: "Lancer la partie") {
GameView() GameView()
}.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32)) }.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))

Loading…
Cancel
Save