public void DispatchRawInputEvent(ERawInputEventType eventType, object eventData) { ERawInputMetaType metaType = InputUtil.GetMetaTypeOfRawEvent(eventType); switch (metaType) { case ERawInputMetaType.Touch: _DispatchTouchRawInputEvent(eventType, eventData); break; case ERawInputMetaType.Axis: _DispatchAxisRawInputEvent(eventType, eventData); break; case ERawInputMetaType.Keyboard: _DispatchKeyboardRawInputEvent(eventType, eventData); break; case ERawInputMetaType.Mouse: _DispatchMouseRawInputEvent(eventType, eventData); break; default: break; } }
public static ERawInputMetaType GetMetaTypeOfRawEventHandler(IRawInputEventHandler handler) { ERawInputMetaType result = ERawInputMetaType.Unknown; if (handler is ITouchInputEventHandler) { result |= ERawInputMetaType.Touch; } if (handler is IAxisInputEventHandler) { result |= ERawInputMetaType.Axis; } if (handler is IKeyboardInputEventHandler) { result |= ERawInputMetaType.Keyboard; } if (handler is IMouseInputEventHandler) { result |= ERawInputMetaType.Mouse; } return(result); }
public void UnregisterRawInputEventHandler(IRawInputEventHandler handler) { ERawInputMetaType metaType = InputUtil.GetMetaTypeOfRawEventHandler(handler); if (metaType != ERawInputMetaType.Unknown) { if ((metaType & ERawInputMetaType.Touch) != 0) { CollectionUtil.RemoveFromTable(ERawInputMetaType.Touch, handler, handlerTable); } if ((metaType & ERawInputMetaType.Axis) != 0) { CollectionUtil.RemoveFromTable(ERawInputMetaType.Axis, handler, handlerTable); } if ((metaType & ERawInputMetaType.Keyboard) != 0) { CollectionUtil.RemoveFromTable(ERawInputMetaType.Keyboard, handler, handlerTable); } if ((metaType & ERawInputMetaType.Mouse) != 0) { CollectionUtil.RemoveFromTable(ERawInputMetaType.Mouse, handler, handlerTable); } } }