parent
ade74defe5
commit
95efe097dd
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Doushouqi_Logo.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 81 KiB |
@ -0,0 +1,109 @@
|
||||
//
|
||||
// HistoryView.swift
|
||||
// DouShouQiIOS
|
||||
//
|
||||
// Created by Pierre FERREIRA on 21/05/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
|
||||
struct HistoryView: View {
|
||||
var playerName: String
|
||||
var matches: [Match] // Modèle des parties du joueur
|
||||
|
||||
var body: some View {
|
||||
|
||||
VStack{
|
||||
Text("Historique du joueur").font(.largeTitle)
|
||||
|
||||
HStack{
|
||||
Spacer()
|
||||
HStack{
|
||||
Text("Ratio")
|
||||
.frame(height: 50, alignment: .center)
|
||||
.padding([.leading, .trailing], 20)
|
||||
.background(Color.yellow)
|
||||
.foregroundColor(Color.white)
|
||||
.bold()
|
||||
.cornerRadius(15)
|
||||
|
||||
Text("0,3")
|
||||
.foregroundColor(.yellow)
|
||||
.padding([.leading], 10)
|
||||
.padding([.trailing], 20)
|
||||
}.overlay(
|
||||
RoundedRectangle(cornerRadius: 15)
|
||||
.stroke(.yellow, lineWidth: 3)
|
||||
)
|
||||
Spacer()
|
||||
HStack{
|
||||
Text("Total")
|
||||
.frame(height: 50, alignment: .center)
|
||||
.padding([.leading, .trailing], 20)
|
||||
.background(Color.yellow)
|
||||
.foregroundColor(Color.white)
|
||||
.bold()
|
||||
.cornerRadius(15)
|
||||
|
||||
Text("\(matches.count)")
|
||||
.foregroundColor(.yellow)
|
||||
.padding([.leading], 10)
|
||||
.padding([.trailing], 20)
|
||||
}.overlay(
|
||||
RoundedRectangle(cornerRadius: 15)
|
||||
.stroke(.yellow, lineWidth: 3)
|
||||
)
|
||||
Spacer()
|
||||
}
|
||||
|
||||
|
||||
List(matches) { match in
|
||||
HStack {
|
||||
Image(match.gameEndScreen)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 50, height: 50)
|
||||
.cornerRadius(8)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(match.opponent)
|
||||
.font(.headline)
|
||||
Text("Score: \(match.score)")
|
||||
.font(.subheadline)
|
||||
}
|
||||
.padding(.leading, 10)
|
||||
|
||||
Spacer()
|
||||
|
||||
Text(match.result)
|
||||
.foregroundColor(match.result == "Victoire" ? .green : .red)
|
||||
.padding(.trailing, 10)
|
||||
}
|
||||
.padding()
|
||||
.background(match.result == "Victoire" ? Color.green.opacity(0.3) : Color.red.opacity(0.3))
|
||||
.cornerRadius(10)
|
||||
}
|
||||
.navigationTitle("\(playerName)'s Historique")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Match: Identifiable {
|
||||
var id = UUID()
|
||||
var gameEndScreen: String
|
||||
var opponent: String
|
||||
var score: String
|
||||
var result: String
|
||||
}
|
||||
|
||||
struct HistoryView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
let sampleMatches = [
|
||||
Match(gameEndScreen: "DouShouQi", opponent: "Opponent 1", score: "3-0", result: "Victoire"),
|
||||
Match(gameEndScreen: "DouShouQi", opponent: "Opponent 2", score: "0-3", result: "Défaite"),
|
||||
Match(gameEndScreen: "DouShouQi", opponent: "Opponent 3", score: "2-2", result: "Nul")
|
||||
]
|
||||
HistoryView(playerName: "bro", matches: sampleMatches)
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
//
|
||||
// MainMenuView.swift
|
||||
// DouShouQiIOS
|
||||
//
|
||||
// Created by Pierre FERREIRA on 21/05/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct MainMenuView: View {
|
||||
var body: some View {
|
||||
VStack {
|
||||
Image("DouShouQi")
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 200, height: 200)
|
||||
|
||||
|
||||
Text("DouShouQi")
|
||||
.font(.largeTitle)
|
||||
.bold()
|
||||
.padding()
|
||||
|
||||
Button(action: {
|
||||
// Action pour Jouer Seul
|
||||
print("Jouer Seul tapped!")
|
||||
}) {
|
||||
Text("Jouer Seul")
|
||||
.font(.title2)
|
||||
.padding()
|
||||
.background(Color.yellow)
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(8)
|
||||
}
|
||||
.padding(.top, 10)
|
||||
|
||||
Button(action: {
|
||||
// Action pour Jouer en Multi
|
||||
print("Jouer en Multi tapped!")
|
||||
}) {
|
||||
Text("Jouer en Multi")
|
||||
.font(.title2)
|
||||
.padding()
|
||||
.background(Color.yellow)
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(8)
|
||||
}
|
||||
|
||||
NavigationLink(destination: PlayerListView()) {
|
||||
Text("Leaderboard")
|
||||
.font(.title2)
|
||||
.padding()
|
||||
.background(Color.yellow)
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(8)
|
||||
}
|
||||
.padding(.top, 20)
|
||||
|
||||
Button(action: {
|
||||
// Quitter
|
||||
print("Quitter tapped!")
|
||||
}
|
||||
) {
|
||||
Text("Quitter")
|
||||
.font(.title2)
|
||||
.padding()
|
||||
.foregroundColor(.yellow)
|
||||
}.overlay(
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.stroke(.yellow, lineWidth: 3)
|
||||
)
|
||||
.padding(.top, 20)
|
||||
|
||||
}.navigationBarBackButtonHidden(true)
|
||||
}
|
||||
}
|
||||
|
||||
struct MainMenuView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MainMenuView()
|
||||
}
|
||||
}
|
Loading…
Reference in new issue