private static IntPtr HookCallback( int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN) { int vkCode = Marshal.ReadInt32(lParam); // UnityEngine.Debug.Log(vkCode); } if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN && Marshal.ReadInt32(lParam) == 162) { KeyboardLocation.GetInstance().LeftControlKeyDown = true; } if (nCode >= 0 && wParam == (IntPtr)WM_KEYUP && Marshal.ReadInt32(lParam) == 162) { KeyboardLocation.GetInstance().LeftControlKeyDown = false; } if (nCode >= 0 && wParam == (IntPtr)WM_KEYUP && Marshal.ReadInt32(lParam) == 39) { KeyboardLocation.GetInstance().RightKeyUp = true; } return(CallNextHookEx(_hookID, nCode, wParam, lParam)); }
public void Init(String type, Boolean bubbles, Boolean cancelable, IWindow view, Int32 detail, String key, KeyboardLocation location, String modifiersList, Boolean repeat) { Init(type, bubbles, cancelable, view, detail); Key = key; Location = location; IsRepeated = repeat; _modifiers = modifiersList; }
// Start is called before the first frame update void Start() { if (_KeyboardLocation == null) { _KeyboardLocation = this; } provider = FindObjectOfType <LeapServiceProvider>() as LeapServiceProvider; }
/// <summary> /// Creates a new event and initializes it. /// </summary> /// <param name="type">The type of the event.</param> /// <param name="bubbles">If the event is bubbling.</param> /// <param name="cancelable">If the event is cancelable.</param> /// <param name="view">Sets the associated view for the UI event.</param> /// <param name="detail">Sets the detail id for the UI event.</param> /// <param name="key">Sets the key that is currently pressed.</param> /// <param name="location">Sets the position of the originating keyboard.</param> /// <param name="modifiersList">A list with keyboard modifiers that have been pressed.</param> /// <param name="repeat">Sets if the key has been pressed again.</param> public KeyboardEvent(String type, Boolean bubbles, Boolean cancelable, IWindow view, Int32 detail, String key, KeyboardLocation location, String modifiersList, Boolean repeat) { Init(type, bubbles, cancelable, view, detail, key, location, modifiersList, repeat); }
public KeyboardEvent(String type, Boolean bubbles = false, Boolean cancelable = false, IWindow view = null, Int32 detail = 0, String key = null, KeyboardLocation location = KeyboardLocation.Standard, String modifiersList = null, Boolean repeat = false) { Init(type, bubbles, cancelable, view, detail, key ?? String.Empty, location, modifiersList ?? String.Empty, repeat); }