public static string GetKeyBoardType(EControllerBtns e) { var actions = ControllerPc.GetActions(); var btn = actions.Get(e); for (int i = 0; i < btn.Bindings.Count; i++) { var a = btn.Bindings[i]; if (a.BindingSourceType == BindingSourceType.KeyBindingSource) { var text = ((KeyBindingSource)a).Control.ToString(); text = text.ToUpper(); if (text.Contains("NUM ")) { text = text.Replace("NUM ", ""); } if (text.Contains("APE")) { text = text.Replace("APE", ""); } return(text); } } return(""); }
public PlayerAction Get(EControllerBtns e) { if (_joyActions.TryGetValue(e, out var action)) { return(action); } Debug.LogError("按键未注册:" + e); return(null); }
public static Mouse GetMouseType(EControllerBtns e) { var actions = ControllerPc.GetActions(); var btn = actions.Get(e); for (int i = 0; i < btn.Bindings.Count; i++) { var a = btn.Bindings[i]; if (a.BindingSourceType == BindingSourceType.MouseBindingSource) { return(((MouseBindingSource)a).Control); } } return(Mouse.None); }
public static InputControlType GetControlType(EControllerBtns e) { var actions = ControllerPc.GetActions(); var btn = actions.Get(e); for (int i = 0; i < btn.Bindings.Count; i++) { var a = btn.Bindings[i]; if (a.BindingSourceType == BindingSourceType.DeviceBindingSource) { return(((DeviceBindingSource)a).Control); } } Debug.LogError("GetControlType Is None:" + e); return(InputControlType.None); }