public override void OnInputEvent(DeviceInputEventArgs e) { if (e.DeviceType != Type) { var arg = e as TouchInputEventArgs; var eventArg = arg.TouchEvent; switch (eventArg.State) { case enTouchState.Down: { TriggerActionMapping(eventArg.State); } break; case enTouchState.Up: { TriggerActionMapping(eventArg.State); } break; case enTouchState.Move: break; } } }
public override void OnInputEvent(DeviceInputEventArgs e) { if (e.DeviceType != Type) { return; } var inputEvent = e as KeyboardInputEventArgs; if (inputEvent.KeyboardEvent.KeyState == KeyState.Press) { if (!mThePressKeys.Contains(inputEvent.KeyboardEvent.KeyCode)) { mThePressKeys.Add(inputEvent.KeyboardEvent.KeyCode); mKeysStateDic[inputEvent.KeyboardEvent.KeyCode] = KeyState.Press; TriggerActionMapping((int)inputEvent.KeyboardEvent.KeyCode, KeyState.Press); OnKeyDown?.Invoke(this, inputEvent.KeyboardEvent); } } else { mKeysStateDic[inputEvent.KeyboardEvent.KeyCode] = KeyState.Release; mThePressKeys.Remove(inputEvent.KeyboardEvent.KeyCode); PulseEndAxisMapping((int)inputEvent.KeyboardEvent.KeyCode); TriggerActionMapping((int)inputEvent.KeyboardEvent.KeyCode, KeyState.Release); OnKeyUp?.Invoke(this, inputEvent.KeyboardEvent); } }
public override void OnInputEvent(DeviceInputEventArgs e) { if (e.DeviceType != Type) { return; } var inputEvent = e as MouseInputEventArgs; var mouseEvent = inputEvent.MouseEvent; mCurrentPoint.X = mouseEvent.X; mCurrentPoint.Y = mouseEvent.Y; if (firstMouseMove) { firstMouseMove = false; mLastPoint = mCurrentPoint; } switch (mouseEvent.State) { case ButtonState.Down: { mThePressKeys.Add((MouseVirtualButtons)mouseEvent.Button); TriggerActionMapping((int)mouseEvent.Button, ButtonState.Down); } break; case ButtonState.Up: { mThePressKeys.Remove((MouseVirtualButtons)mouseEvent.Button); TriggerActionMapping((int)mouseEvent.Button, ButtonState.Up); PulseEndAxisMapping((int)mouseEvent.Button); } break; case ButtonState.Move: { zeroTimes = 0; if ((mCurrentPoint - mLastPoint).Length() > MathHelper.Epsilon) { var delta = mCurrentPoint - mLastPoint; TriggerActionMoveMapping((int)MouseVirtualButtons.Move, ButtonState.Move, mCurrentPoint.X, mCurrentPoint.Y, delta.X, delta.Y); } } break; case ButtonState.WheelScroll: { if (mouseEvent.Delta > 0) { TriggerActionMapping((int)MouseVirtualButtons.WheelScroll_Up, ButtonState.WheelScroll); } else { TriggerActionMapping((int)MouseVirtualButtons.WheelScroll_Down, ButtonState.WheelScroll); } } break; } //mLastPoint = mCurrentPoint; }
public void OnInputEvnet(EngineNS.Input.Device.DeviceInputEventArgs e) { // 抛送到逻辑线程 EngineNS.CEngine.Instance.EventPoster.RunOn(() => { using (var it = mDevices.GetEnumerator()) { while (it.MoveNext()) { it.Current.Value.OnInputEvent(e); } } UIInputProcess(e); return(true); }, Thread.Async.EAsyncTarget.Logic); }
partial void UIInputProcess(EngineNS.Input.Device.DeviceInputEventArgs e);