//
//  SelectPlayerView.swift
//  DouShouQi_App
//
//  Created by nathan on 23/05/2024.
//

import SwiftUI
import SpriteKit
import DouShouQiModel

struct SelectPlayerView: View {
    
    @StateObject var player1 = PlayerVM()
    @StateObject var player2 = PlayerVM()
    
    var body: some View {
        VStack {
            TitlePageFrame(Text: "select players")
            
            Spacer()
            
            SelectPlayerButtonView(player1: player1, player2: player2, playersVM: PlayersVM())

            Spacer()
            
            HStack {
                VStack(alignment: .trailing)
                {
                    MainMenuButton(text: "Start", destination: GameView(gameVM: PlayingGameVM(withRules: ClassicRules(), andPlayer1: HumanPlayer(withName: player1.player.name, andId: .player1)!, andPlayer2: HumanPlayer(withName: player2.player.name, andId: .player2)!)!), sound: "TitleScreenButtonSound", horizontalAlignment: .trailing, topLeftCorner: 10, bottomLeftCorner: 10)
                    MainMenuButton(text: "Settings", destination: ContentView(), sound: "TitleScreenButtonSound", horizontalAlignment: .trailing, topLeftCorner: 10, bottomLeftCorner: 10)
                }
            }
            
            Spacer()
        }
    }
}

/*struct SelectPlayerViewPreviews: PreviewProvider {
    static var previews: some View {
        SelectPlayerView()
    }
}*/
