using UnityEngine;
using UnityEngine.UI;

public class MenuManager : MonoBehaviour
{
    public Image menuImage; // L'image affichée dans le menu
    public Sprite[] menuSprites; // Tableau des 9 images de menu

    private int player1Skin;
    private int player2Skin;

    void Start()
    {
        player1Skin = PlayerPrefs.GetInt("SelectedSkin_Player1", 0);
        player2Skin = PlayerPrefs.GetInt("SelectedSkin_Player2", 0);
        UpdateMenuImage();
    }

    void UpdateMenuImage()
    {
        int imageIndex = GetMenuImageIndex(player1Skin, player2Skin);

        if (imageIndex >= 0 && imageIndex < menuSprites.Length)
        {
            menuImage.sprite = menuSprites[imageIndex];
        }
    }

    int GetMenuImageIndex(int skin1, int skin2)
    {
        return skin1 * 3 + skin2; // Adapter selon ton nombre de skins
    }
}