ajout de style et de la classe player 💄

gameBranch^2
Pierre FERREIRA 12 months ago
parent 7017ff9285
commit ade74defe5

@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
7B3B17642BF24B32002BC817 /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3B17632BF24B32002BC817 /* Player.swift */; };
7B3B17672BF24ED6002BC817 /* FullButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3B17662BF24ED6002BC817 /* FullButtonStyle.swift */; };
7B4508CD2BF206AF0027E1EF /* DouShouQiIOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4508CC2BF206AF0027E1EF /* DouShouQiIOSApp.swift */; };
7B4508CF2BF206AF0027E1EF /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4508CE2BF206AF0027E1EF /* ContentView.swift */; };
7B4508D12BF206B10027E1EF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B4508D02BF206B10027E1EF /* Assets.xcassets */; };
@ -36,6 +38,8 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
7B3B17632BF24B32002BC817 /* Player.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Player.swift; sourceTree = "<group>"; };
7B3B17662BF24ED6002BC817 /* FullButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullButtonStyle.swift; sourceTree = "<group>"; };
7B4508C92BF206AF0027E1EF /* DouShouQiIOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DouShouQiIOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
7B4508CC2BF206AF0027E1EF /* DouShouQiIOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DouShouQiIOSApp.swift; sourceTree = "<group>"; };
7B4508CE2BF206AF0027E1EF /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
@ -75,6 +79,22 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
7B3B17622BF24B23002BC817 /* Class */ = {
isa = PBXGroup;
children = (
7B3B17632BF24B32002BC817 /* Player.swift */,
);
path = Class;
sourceTree = "<group>";
};
7B3B17652BF24EB1002BC817 /* Struct */ = {
isa = PBXGroup;
children = (
7B3B17662BF24ED6002BC817 /* FullButtonStyle.swift */,
);
path = Struct;
sourceTree = "<group>";
};
7B4508C02BF206AF0027E1EF = {
isa = PBXGroup;
children = (
@ -98,6 +118,9 @@
7B4508CB2BF206AF0027E1EF /* DouShouQiIOS */ = {
isa = PBXGroup;
children = (
7B3B17652BF24EB1002BC817 /* Struct */,
7B3B17622BF24B23002BC817 /* Class */,
7BB801372BF2374C00413951 /* Style */,
7B4508CC2BF206AF0027E1EF /* DouShouQiIOSApp.swift */,
7B4508CE2BF206AF0027E1EF /* ContentView.swift */,
7B4508D02BF206B10027E1EF /* Assets.xcassets */,
@ -141,6 +164,13 @@
path = View;
sourceTree = "<group>";
};
7BB801372BF2374C00413951 /* Style */ = {
isa = PBXGroup;
children = (
);
path = Style;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -274,6 +304,8 @@
7B4508F72BF2084B0027E1EF /* PlayerView.swift in Sources */,
7B4508CF2BF206AF0027E1EF /* ContentView.swift in Sources */,
7B4508CD2BF206AF0027E1EF /* DouShouQiIOSApp.swift in Sources */,
7B3B17642BF24B32002BC817 /* Player.swift in Sources */,
7B3B17672BF24ED6002BC817 /* FullButtonStyle.swift in Sources */,
7B4508FA2BF214F50027E1EF /* PlayerListView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

@ -0,0 +1,30 @@
//
// Player.swift
// DouShouQiIOS
//
// Created by Pierre FERREIRA on 13/05/2024.
//
import Foundation
/// Représente un joueur
public class Player {
public let id: String
public let name: String
public let sname: String
public let age: Int
/// Initialise un joueur
public init?(withName name: String, andSName sname: String, andId id: String, andAge age : Int){
// Vérification de la validité de l'identifiant
guard id != "" else {
return nil
}
self.id = id
self.name = name
self.sname = sname
self.age = age
}
}

@ -0,0 +1,20 @@
//
// FullButtonStyle.swift
// DouShouQiIOS
//
// Created by Pierre FERREIRA on 13/05/2024.
//
import Foundation
import SwiftUI
struct FullButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.padding(10)
.background(Color.yellow)
.foregroundStyle(.white)
.clipShape(Rectangle())
.cornerRadius(15)
}
}

@ -9,21 +9,30 @@ import SwiftUI
struct PlayerListView: View {
var body: some View {
VStack{
Text("Classement des joueurs").scaleEffect(1.75)
NavigationStack {
List {
NavigationLink("Billy", value: "Billy")
NavigationLink("Bob", value: "Bob")
NavigationLink("Bromingo", value: "Bromingo")
}
.navigationDestination(for: String.self) { name in
PlayerView(name: name)
ZStack{
//Rectangle().fill(Color.yellow)
VStack{
Text("Classement des joueurs")
.scaleEffect(1.75)
NavigationStack {
List {
NavigationLink("Billy", value: "Billy")
NavigationLink("Bob", value: "Bob")
NavigationLink("Bromingo", value: "Bromingo")
}
.background(Color.yellow)
.navigationDestination(for: String.self) { name in
PlayerView(name: name)
}
.navigationTitle("Leaderboard")
}
.navigationTitle("Players")
}
}.background(Color.yellow)
Button("Menu") {
print("About tapped!")
}.buttonStyle(FullButtonStyle())
}
}
}

@ -8,49 +8,89 @@
import SwiftUI
struct PlayerView: View {
var Player : Player;
var name : String;
var body: some View {
ZStack{
Rectangle().fill(Color.indigo)
Rectangle().fill(Color.orange.opacity(0.1))
VStack{
Text("Détail du joueur").font(.title)
HStack{
Image("Blob")
.scaleEffect(0.5)
.frame(width: 20, height: 20)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 100, height: 100)
.clipShape(Circle())
.overlay(Circle().strokeBorder(Color.orange, lineWidth: 2))
.scaleEffect(1)
.transformEffect(.identity)
Spacer()
VStack(alignment: .leading){
Text("Name : \(name)")
Text("Sname :")
Text("\(name)").font(.largeTitle)
Text("Sname :").font(.title2)
Text("Age :")
Text("Classement :")
}.background(Color.pink)
}.padding(40).background(Color.purple)
} .frame(width: 200, height: 150)
.background(Color.orange.opacity(0.3))
.cornerRadius(15)
}.padding(20)
.background(Color.yellow)
.cornerRadius(15)
Spacer()
VStack{
Text("Statistiques").fontWeight(.heavy)
Text("Statistiques")
.fontWeight(.heavy)
.font(.largeTitle)
Grid{
GridRow{
Text("Nb Win").frame(width: 100, height: 50, alignment: .center)
.border(.black, width: 4)
.cornerRadius(15)
Text("9")
}
HStack{
Text("Nombre de victoires").frame(width: 100, height: 50, alignment: .center)
Text("9")
}
} .frame(width: 150)
.background(Color.orange.opacity(0.3))
.cornerRadius(15)
GridRow{
Text("Nb Los").frame(width: 100, height: 50, alignment: .center)
.border(.black, width: 4)
.cornerRadius(15)
Text("5")
}
HStack{
Text("Nombre de défaites").frame(width: 100, height: 50, alignment: .center)
Text("5")
}
} .frame(width: 150)
.background(Color.orange.opacity(0.3))
.cornerRadius(15)
GridRow{
Text("Nb Game").frame(width: 100, height: 50, alignment: .center)
.border(.black, width: 4)
.cornerRadius(15)
Text("14")
}
}
}.background(Color.orange).scaleEffect(1.5)
HStack{
Text("Nombre de parties jouées").frame(width: 100, height: 50, alignment: .center)
Text("14")
}
} .frame(width: 150)
.background(Color.orange.opacity(0.3))
.cornerRadius(15)
}.frame(
minWidth: 0,
maxWidth: .infinity,
alignment: .center
)
Spacer()
}
.foregroundStyle(.white)
.background(Color.yellow)
.cornerRadius(15)
.padding(20)
Spacer()
}.padding(20)//.background(Color.purple)
}.padding(20)
}
}
@ -58,6 +98,7 @@ struct PlayerView: View {
struct PlayerView_Previews: PreviewProvider {
static var previews: some View {
PlayerView(name: "bro")
var player1 = new Player(Player(withName: "Meruemu", andSName: "Roi", andId: 2, andAge: 1)
PlayerView(name: "bro", player1)
}
}

Loading…
Cancel
Save