solve merge conflict

dev_ARKit^2
Rayhân HASSOU 10 months ago
parent f5428fdb18
commit 2927a0d285

@ -92,6 +92,6 @@ struct RoundedCornersShape: Shape {
struct MainMenuButton_Previews: PreviewProvider { struct MainMenuButton_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
MainMenuButton(text: "test", destination: HistoricView(historicListVM: HistoricListVM()), sound: "TitleScreenButtonSound", horizontalAlignment: .leading, topRightCorner: 10, bottomRightCorner: 10) MainMenuButton(text: "test", sound: "TitleScreenButtonSound", horizontalAlignment: .leading, topRightCorner: 10, bottomRightCorner: 10)
} }
} }

@ -3,7 +3,6 @@ import SpriteKit
import DouShouQiModel import DouShouQiModel
struct GameView: View { struct GameView: View {
var gameScene: GameScene = GameScene(size: CGSize(width: 700, height: 900))
@StateObject var gameVM: PlayingGameVM @StateObject var gameVM: PlayingGameVM
@StateObject var chronoVM = ChronometerViewModel() @StateObject var chronoVM = ChronometerViewModel()
@ -11,8 +10,6 @@ struct GameView: View {
@Binding var isDisplayed: Bool @Binding var isDisplayed: Bool
@Binding var parentIsDisplayed: Bool @Binding var parentIsDisplayed: Bool
var player1_name: String
var player2_name: String
@StateObject var historicVm = HistoricListVM() @StateObject var historicVm = HistoricListVM()
var body: some View { var body: some View {
@ -65,7 +62,9 @@ struct GameView: View {
} }
private func saveHistoric() { private func saveHistoric() {
let newHistoric = HistoricVM(historic: Historique(player1_name: player1_name, player2_name: player2_name, time: chronoVM.formattedTime(), result: gameVM.winner)) let player1_name = gameVM.game.players[.player1]?.name
let player2_name = gameVM.game.players[.player2]?.name
let newHistoric = HistoricVM(historic: Historique(player1_name: player1_name ?? "", player2_name: player2_name ?? "", time: chronoVM.formattedTime(), result: gameVM.winner))
historicVm.SavePlayer(historic: newHistoric) historicVm.SavePlayer(historic: newHistoric)
} }
} }

@ -54,7 +54,7 @@ struct MainMenuView: View {
SelectPlayerView(isDisplayed: $showSelectPlayer) SelectPlayerView(isDisplayed: $showSelectPlayer)
} }
.navigationDestination(isPresented: $showHistoric) { .navigationDestination(isPresented: $showHistoric) {
HistoricView(historicVM: HistoricVM()) HistoricView(historicListVM: historicList)
} }
.navigationDestination(isPresented: $showBestScores) { .navigationDestination(isPresented: $showBestScores) {
ScoreBoardView() ScoreBoardView()

@ -37,7 +37,7 @@ struct SelectPlayerView: View {
} }
.navigationDestination(isPresented: $gameIsPlaying) { .navigationDestination(isPresented: $gameIsPlaying) {
GameView(gameVM: PlayingGameVM(withRules: ClassicRules(), andPlayer1: HumanPlayer(withName: player1.player.name, andId: .player1)!, andPlayer2: HumanPlayer(withName: player2.player.name, andId: .player2)!)!, isDisplayed: $gameIsPlaying, parentIsDisplayed: $isDisplayed) GameView(gameVM: PlayingGameVM(withRules: ClassicRules(), andPlayer1: HumanPlayer(withName: player1.player.name, andId: .player1)!, andPlayer2: HumanPlayer(withName: player2.player.name, andId: .player2)!)!,isDisplayed: $gameIsPlaying, parentIsDisplayed: $isDisplayed)
} }
.navigationDestination(isPresented: $gameSettings) { .navigationDestination(isPresented: $gameSettings) {
ContentView() ContentView()

Loading…
Cancel
Save