🚧 Update: SelectPlayerButtonView for call ShowAllPlayer sheet

dev_save_game
Nathan VERDIER 11 months ago
parent 581d2a5a2d
commit b4a98873a8

@ -35,8 +35,17 @@ struct CustomShapeRightButton: Shape {
struct SelectPlayerButtonView: View { struct SelectPlayerButtonView: View {
var player1:String = "IA" @State var player1:String = "IA"
var player2:String = "IA" @State var player2:String = "IA"
@State private var players = [
Player(name: "Rayhan", wins: 7, losses: 6, photo: "shrek"),
Player(name: "Remi", wins: 7, losses: 2, photo: "shrek"),
Player(name: "Nathan", wins: 14, losses: 5, photo: "shrek")
]
@State private var showingPopup = false
var body: some View { var body: some View {
ZStack{ ZStack{
Image("vs-custom") Image("vs-custom")
@ -51,6 +60,15 @@ struct SelectPlayerButtonView: View {
.padding(3) .padding(3)
Button(action: { Button(action: {
print("Button j1 pressé!") print("Button j1 pressé!")
if (player1 == "IA"){
if (player2 == "Player1"){
player1="Player2"
}else{
player1="Player1"
}
}else{
player1="IA"
}
}) { }) {
VStack { VStack {
Text("+") Text("+")
@ -62,9 +80,8 @@ struct SelectPlayerButtonView: View {
} }
.frame(width: 150, height: 150) .frame(width: 150, height: 150)
.padding() .padding()
.border(/*@START_MENU_TOKEN@*/Color.black/*@END_MENU_TOKEN@*/, width: 4) .border(Colors.TitleText, width: 4)
.foregroundColor(.black) .foregroundColor(Colors.TitleText)
.foregroundColor(.white)
.cornerRadius(10) .cornerRadius(10)
.clipShape(CustomShapeLeftButton()) .clipShape(CustomShapeLeftButton())
} }
@ -76,6 +93,7 @@ struct SelectPlayerButtonView: View {
Button(action: { Button(action: {
print("Button j2 pressé!") print("Button j2 pressé!")
showingPopup = true
}) { }) {
VStack { VStack {
Text("+") Text("+")
@ -84,11 +102,13 @@ struct SelectPlayerButtonView: View {
Text("Add a player") Text("Add a player")
.font(.body) .font(.body)
.bold() .bold()
/*.sheet(isPresented: $showingPopup) {
ShowAllPlayer
}*/
} .frame(width: 150, height: 150) } .frame(width: 150, height: 150)
.padding() .padding()
.foregroundColor(.black) .border(Colors.TitleText, width: 4)
.border(/*@START_MENU_TOKEN@*/Color.black/*@END_MENU_TOKEN@*/, width: 4) .foregroundColor(Colors.TitleText)
.foregroundColor(.white)
.cornerRadius(10) .cornerRadius(10)
.clipShape(CustomShapeRightButton()) .clipShape(CustomShapeRightButton())
} }

Loading…
Cancel
Save