This commit is contained in:
CortexCore
2024-03-31 23:31:00 +08:00
parent e179d2eb53
commit b7b89ee71a
641 changed files with 31286 additions and 22134 deletions

View File

@@ -3,6 +3,8 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using System;
using System.Linq;
namespace BITKit
{
public static partial class InputSystemExtensions
@@ -18,6 +20,15 @@ namespace BITKit
self.canceled += action;
return self;
}
public static string GetKeyMap(this InputAction self)
{
return string.Join("|", self.bindings.Select(x=>x.path.Split("/").Last().ToUpper()));
}
public static string GetKeyMap(this InputActionReference self)
{
return string.Join("|", self.action.bindings.Select(x=>x.path.Split("/").Last().ToUpper()));
}
public static InputAction UnRegisterCallback(this InputAction self, Action<InputAction.CallbackContext> action)
{
self.performed -= action;