﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
class Inputs
{

}
public class InputMgr : MonoBehaviour
{
    KeyCode codeF = KeyCode.F;
    public List<KeyCode> listKeys;
    EventSystem eventSystem;
    static InputMgr instance;
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
        //codeF = ;
        //Application.
        eventSystem = EventSystem.current;
        print(EventSystem.current);
    }
    private void Start()
    {
        //Input.ResetInputAxes();
        //SceneManager.activeSceneChanged += ChangedActiveScene;
    }
    private void OnEnable()
    {
        if (instance != null)
        {
            print("Enab");
            SceneManager.UnloadSceneAsync("Assets/Scenes/Start.unity");
            SceneManager.LoadScene("Assets/Scenes/SampleScene.unity", LoadSceneMode.Additive);
        }

    }

    public void UnloadStage(Scene current)
    {
        print("UnloadStage:" + current.name);
        SceneManager.LoadScene("Assets/Scenes/SampleScene.unity", LoadSceneMode.Additive);
    }
    private void LateUpdate()
    {
        //KeyCheck();
    }
    void KeyCheck()
    {
        //print("KeyCheck");
        int cnt = 0;
        foreach (KeyCode code in System.Enum.GetValues(typeof(KeyCode)))
        {
           
            if (Input.GetKey(code))
            {
                //処理を書く
                //print(code.HasFlag());
                cnt++;
            }
        }
        if(cnt != 0 ) print(cnt);
    }
    void OnGUI()
    {
        KeyCheck();
    }
    private void ChangedActiveScene(Scene current, Scene next)
    {
        string currentName = current.name;

        if (currentName == null)
        {
            // Scene1 has been removed
            currentName = "Replaced";
        }

        Debug.Log("Scenes: " + currentName + ", " + next.name);
    }
}
