Merge pull request 'dev_views_stats' (#13) from dev_views_stats into dev_views

Reviewed-on: #13
pull/14/head
Rayhân HASSOU 11 months ago
commit 049d2a0703

@ -46,6 +46,7 @@
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 */; };
EC62C51B2C09D1790048CD0B /* PlayerStatView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C51A2C09D1790048CD0B /* PlayerStatView.swift */; };
ECB636552C047992007CD5E2 /* Image.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ECB636542C047992007CD5E2 /* Image.xcassets */; };
/* End PBXBuildFile section */
@ -109,6 +110,7 @@
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>"; };
EC62C5162C0620C00048CD0B /* rap.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = rap.mp3; sourceTree = "<group>"; };
EC62C51A2C09D1790048CD0B /* PlayerStatView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerStatView.swift; sourceTree = "<group>"; };
ECB636542C047992007CD5E2 /* Image.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Image.xcassets; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -210,6 +212,7 @@
647D565B2BFD0212008D02EA /* PlayerResumeFrame.swift */,
EC62C4FC2C0391D30048CD0B /* PlayerRow.swift */,
EC62C50E2C05D06A0048CD0B /* AddPlayerView.swift */,
EC62C51A2C09D1790048CD0B /* PlayerStatView.swift */,
);
path = Player;
sourceTree = "<group>";
@ -489,6 +492,7 @@
645B4C252BFCD3C600FD658A /* ScoreBoardView.swift in Sources */,
649B59AE2BF64EAB002BAE38 /* AppImages.swift in Sources */,
649ABF602BF60F2D002E8894 /* MainMenuButton.swift in Sources */,
EC62C51B2C09D1790048CD0B /* PlayerStatView.swift in Sources */,
643AB6932BFCEFD00018DA73 /* GameResumeFrame.swift in Sources */,
649B59B22BF65392002BAE38 /* TextStyles.swift in Sources */,
EC62C5092C0467240048CD0B /* SplashScreenView.swift in Sources */,

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "SemiCat.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "layer1(6)(1).png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "SemiElephant.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "SemiLeopard.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "SemiRat.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "SemiTiger.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "SemiWolf.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

@ -12,6 +12,8 @@ struct PlayerRow: View {
var player: Player
@Binding var players: [Player]
@State private var showDetailView = false
var body: some View {
HStack {
if let image = UIImage(contentsOfFile: player.photo) {
@ -35,17 +37,13 @@ struct PlayerRow: View {
}
Spacer()
Button(action: {
// Action pour éditer le joueur
showDetailView.toggle()
}) {
Image(systemName: "pencil")
.foregroundColor(.black)
Image(systemName: "info.circle")
.foregroundColor(.blue)
}
Button(action: {
}) {
Image(systemName: "trash")
.foregroundColor(.red)
.sheet(isPresented: $showDetailView) {
PlayerStatView(player: player)
}
}
.padding()
@ -54,5 +52,3 @@ struct PlayerRow: View {
.shadow(radius: 1)
}
}

@ -0,0 +1,61 @@
//
// PlayerStatView.swift
// DouShouQi_App
//
// Created by étudiant on 31/05/2024.
//
import SwiftUI
struct PlayerStatView: View {
var player: Player
var body: some View {
VStack {
if let image = UIImage(contentsOfFile: player.photo) {
Image(uiImage: image)
.resizable()
.frame(width: 100, height: 100)
.clipShape(Circle())
.padding(.top, 10)
} else {
Image(systemName: "person.circle.fill")
.resizable()
.frame(width: 100, height: 100)
.clipShape(Circle())
.foregroundColor(.gray)
.padding(.top, 10)
}
Text(player.name)
.font(.largeTitle)
.foregroundColor(.black)
.padding(.top, 10)
VStack(alignment: .leading, spacing: 10) {
HStack {
Image(systemName: "trophy.fill")
Text("Win : \(player.wins)")
.font(.title2)
}
HStack {
Image(systemName: "xmark.circle.fill")
Text("Loose : \(player.losses)")
.font(.title2)
}
HStack {
Image(systemName: "chart.line.uptrend.xyaxis")
Text("Win Rate : \(String(format: "%.2f", Double(player.wins) / Double(player.wins + player.losses) * 100))%")
.font(.title2)
}
HStack {
Image(systemName: "list.number")
Text("Rank : 3")
.font(.title2)
}
}
.padding()
Spacer()
}
}
}
Loading…
Cancel
Save