parent
15af2dc093
commit
f129ea661c
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 443 KiB |
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "BackGroundImage.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
//
|
||||
// ContentView.swift
|
||||
// WtaTennis
|
||||
//
|
||||
// Created by Johan LACHENAL on 14/05/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ContentView: View {
|
||||
var body: some View {
|
||||
VStack {
|
||||
Image(systemName: "globe")
|
||||
.imageScale(.large)
|
||||
.foregroundColor(.accentColor)
|
||||
Text("Hello, world!")
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
//
|
||||
// MainMenu.swift
|
||||
// ArkitDoushiQi
|
||||
//
|
||||
// Created by Johan LACHENAL on 16/05/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct MainMenu: View {
|
||||
@EnvironmentObject var languageSettings: LanguageSettings
|
||||
let playButtonText: String
|
||||
let registeredGamesButtonText: String
|
||||
@State private var action: Int? = 0
|
||||
@AppStorage("isDarkMode") private var isDarkMode = false
|
||||
@State private var reloadView = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
ZStack {
|
||||
// Ajouter l'image en arrière-plan
|
||||
Image("BackGroundMenu")
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
|
||||
|
||||
|
||||
VStack {
|
||||
// Ajouter un HStack pour le titre et l'icône des paramètres
|
||||
HStack {
|
||||
|
||||
Button(action: {
|
||||
isDarkMode.toggle()
|
||||
}) {
|
||||
Image(systemName: isDarkMode ? "sun.max.fill" : "moon.fill")
|
||||
.foregroundColor(.white)
|
||||
.padding()
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
// Action pour changer la langue
|
||||
NotificationCenter.default.post(name: NSNotification.Name("LanguageChanged"), object: nil)
|
||||
}) {
|
||||
Image(systemName: "globe")
|
||||
.foregroundColor(.white)
|
||||
.padding()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
// Bouton "Jouer" au centre et plus grand, sans bandeau bleu
|
||||
NavigationLink(destination: GameParametersMenuView())
|
||||
{
|
||||
Text(playButtonText)
|
||||
.font(.largeTitle)
|
||||
.bold()
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(Color.white.opacity(0.2))
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(10)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.stroke(Color.white, lineWidth: 2)
|
||||
)
|
||||
.shadow(radius: 10)
|
||||
}
|
||||
.padding(.horizontal, 50)
|
||||
|
||||
|
||||
Spacer().frame(height: 40)
|
||||
|
||||
// Bouton "Parties enregistrées" plus discret
|
||||
NavigationLink(destination: PartyListView())
|
||||
{
|
||||
Text(registeredGamesButtonText)
|
||||
.font(.headline)
|
||||
.padding()
|
||||
.background(Color.gray.opacity(0.7))
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(10)
|
||||
.shadow(radius: 5)
|
||||
}
|
||||
.padding(.horizontal, 50)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))
|
||||
}
|
||||
.environmentObject(languageSettings)
|
||||
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("LanguageChanged"))) { _ in
|
||||
self.reloadView.toggle() // Changez la valeur pour forcer le rechargement
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MainMenu_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MainMenu(playButtonText: "Play", registeredGamesButtonText: "Registered Games")
|
||||
.environmentObject(LanguageSettings(selectedLanguage: .French))
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
//
|
||||
// MainMenu.swift
|
||||
// ArkitDoushiQi
|
||||
//
|
||||
// Created by Johan LACHENAL on 16/05/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct MainMenu: View {
|
||||
@EnvironmentObject var languageSettings: LanguageSettings
|
||||
let playButtonText: String
|
||||
let registeredGamesButtonText: String
|
||||
let parametersButtonText: String
|
||||
@State private var action: Int? = 0
|
||||
@AppStorage("isDarkMode") private var isDarkMode = false
|
||||
@State private var reloadView = false // Déclarer reloadView ici
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
NavigationView {
|
||||
VStack {
|
||||
Spacer()
|
||||
HStack() {
|
||||
Text("DouShiQi")
|
||||
.bold()
|
||||
.font(.title).padding()
|
||||
}
|
||||
Spacer().frame(height: 40)
|
||||
VStack(alignment: .leading) {
|
||||
ButtonComponent(title: playButtonText)
|
||||
{ GameParametersMenuView() }
|
||||
Spacer().frame(height: 30)
|
||||
ButtonComponent(title: registeredGamesButtonText)
|
||||
{ PartyListView() }
|
||||
Spacer().frame(height: 30)
|
||||
ButtonComponent(title: parametersButtonText)
|
||||
{ GeneralParametersMenuView(
|
||||
selectedAIOption: .RandomAction,
|
||||
selectedRulesOption: .Regular
|
||||
).id(reloadView) // Utilisez l'ID pour forcer le rechargement de la vue
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))
|
||||
}
|
||||
.environmentObject(languageSettings)
|
||||
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("LanguageChanged"))) { _ in
|
||||
self.reloadView.toggle() // Changez la valeur pour forcer le rechargement
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MainMenu_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MainMenu(playButtonText: "Jouer", registeredGamesButtonText: "Parties enregistrées", parametersButtonText: "Paramètres")
|
||||
.environmentObject(LanguageSettings(selectedLanguage: .French))
|
||||
}
|
||||
}
|
Loading…
Reference in new issue