BITKit/Packages/Runtime~/Unity/Common/Scripts/InputSystem/BITInputSystem.cs

46 lines
1.2 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEngine.UIElements;
using UnityEditor;
using UnityEditor.UIElements;
#endif
namespace BITKit
{
public class BITInputSystem
{
[RuntimeInitializeOnLoadMethod]
static void Reload()
{
AllowInput = new();
}
public static ValidHandle AllowInput = new();
}
#if UNITY_EDITOR
public class BITInputSystemEditor : EditorWindow
{
Toggle allowInput;
[MenuItem("Tools/InputSystemEditor")]
static void Entry()
{
GetWindow<BITInputSystemEditor>().Show();
}
private void OnEnable()
{
rootVisualElement.style.paddingLeft =
rootVisualElement.style.paddingTop =
rootVisualElement.style.paddingRight =
rootVisualElement.style.paddingBottom = 16;
rootVisualElement.Add(allowInput =new Toggle());
allowInput.text = "Enable Input";
}
private void Update()
{
allowInput.value = BITInputSystem.AllowInput;
}
}
#endif
}