using System.Collections.Generic;
using System.Linq;
using UnityEngine;
//using UnityEditor;

namespace ScrambleKit.Move
{
    //[CustomEditor(typeof(MoveInputSource))]
    public class MoveInputSourceEditor //: Editor
    {
        //private MoveInputSource input;
        //private HashSet<string> foundNames;

        //public override void OnInspectorGUI()
        //{
        //    DrawDefaultInspector();

            
        //    if (GUILayout.Button("Refresh Input List"))
        //    {
        //        input = (MoveInputSource)target;
        //        FindInputNames();
        //        RemoveUnneededInputs();
        //        AddNewInputs();
        //    }
        //}

        //private HashSet<string> FindInputNames()
        //{
        //    foundNames = new HashSet<string>();
        //    input.BroadcastMessage("AddBindingNames", foundNames);
        //    return foundNames;
        //}

        //private void RemoveUnneededInputs()
        //{            
        //    input.Bindings.RemoveAll(b => !foundNames.Contains(b.inputName));
        //}

        //private void AddNewInputs()
        //{
        //    var names = input.Bindings.Select(b => b.inputName);
        //    foreach (string name in foundNames)
        //    {
        //        if (names.Contains(name))
        //            continue;
        //        input.Bindings.Add(new InputBinding { inputName = name, key = KeyCode.None });
        //    }
        //}
    }

}