import java.awt.*;
import javax.swing.JFrame;
import javax.swing.*;

public class MultiMenuView {
    int semesterCounter = 1;
    private JPanel multiPanel = new JPanel(null);

    private ImageIcon humanPlayerIcon = new ImageIcon("graphics/humanPlayer.png");
    private ImageIcon aiPlayerIcon = new ImageIcon("graphics/aiPlayer.png");

    JButton PlayerLeftButton = new JButton("<-");
    JButton PlayerRightButton = new JButton("->");
    JButton semesterUpButton = new JButton("^");
    JButton semesterDownButton = new JButton("v");

    JLabel semesterLabel = new JLabel("Semester");
    private JLabel titelLabel = new JLabel("Multiplayer");
    private JLabel PlayerIcon = new JLabel(humanPlayerIcon);
    private JLabel PlayerName = new JLabel("Name");
    private JTextField PlayerTextField = new JTextField(20);
    JLabel semesterCounterLabel = new JLabel(String.valueOf(semesterCounter));

    private Font robotoFont = new Font("Roboto", Font.BOLD, 45);
    public MultiMenuView() {
        buildPanel();
    }


    public void buildPanel(){
        titelLabel.setBounds(20,20,700,100);
        PlayerIcon.setBounds(75, 400, 200, 128);
        PlayerName.setBounds(50, 625, 200, 30);
        PlayerTextField.setBounds(50, 650, 250, 50);
        semesterCounterLabel.setBounds(725, 475, 50, 50); // zwischen den Up/Down-Buttons
        PlayerLeftButton.setBounds(50, 450, 50, 50);
        PlayerRightButton.setBounds(250, 450, 50, 50);
        semesterLabel.setBounds(500, 400, 200, 30);
        semesterUpButton.setBounds(700, 400, 50, 50);
        semesterDownButton.setBounds(700, 550, 50, 50);


        multiPanel.setLayout(null);
        titelLabel.setFont(robotoFont.deriveFont(50f));
        semesterLabel.setFont(robotoFont.deriveFont(20f));

        multiPanel.add(PlayerName);
        multiPanel.add(titelLabel);
        multiPanel.add(PlayerIcon);
        multiPanel.add(PlayerTextField);
        multiPanel.add(semesterCounterLabel);
        multiPanel.add(semesterUpButton);
        multiPanel.add(semesterDownButton);
        multiPanel.add(PlayerLeftButton);
        multiPanel.add(PlayerRightButton);
        multiPanel.add(semesterLabel);
    }

    public JPanel getMultiPanel() {
        return multiPanel;
    }

    //public void showMultiPanel(String panelName) {
       // CardLayout cl = (CardLayout)mainPanel.getLayout();
      //  cl.show(multiPanel, panelName);
    //}

    public void togglePlayerIcon() {
        if (PlayerIcon.getIcon() == humanPlayerIcon) {
            PlayerIcon.setIcon(aiPlayerIcon);
        } else {
            PlayerIcon.setIcon(humanPlayerIcon);
        }
    }

    public JButton getPlayerLeftButton() {
        return PlayerLeftButton;
    }

    public JButton getPlayerRightButton() {
        return PlayerRightButton;
    }
}
