using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UDB.UI;
using UnityEngine.Events;
#if UNITY_SWITCH
using nn.hid;
#endif

public class ControllerSupportMenu : MonoBehaviour
{
    public QuestionCoordinator questionCoordinator;
    public UnityEvent OnShow;

    public void Show()
    {
#if UNITY_SWITCH
        questionCoordinator.ShowQuestion("How many controllers?", "1-4", "5-9", () => {
            Show(4);
        }, () => {
            Show(8);
        });
#endif
    }

    public void Show(int playerCountMax)
    {
        OnShow?.Invoke();
#if UNITY_SWITCH
        ControllerSupportArg controllerSupportArg = new ControllerSupportArg();
        controllerSupportArg.SetDefault();
        controllerSupportArg.playerCountMax = (byte)(playerCountMax);

        Debug.Log(controllerSupportArg);
        nn.Result result = ControllerSupport.Show(controllerSupportArg);
        if (!result.IsSuccess()) {
            Debug.Log(result);
        }
#endif
    }
}
