public void Initialize( IMessageReceiver receiver, IMessageSender sender, RawInputChecker rawInputChecker, XInputGamePad gamepadListener, MidiInputObserver midiObserver ) { _keyboard = new KeyboardToWordToMotion(rawInputChecker); _midi = new MidiToWordToMotion(receiver, sender, midiObserver); _gamepad = new GamepadToWordToMotion(gamepadListener); _wordAnalyzer = new WordAnalyzer(); _keyboard.RequestExecuteWordToMotionItem += v => { if (UseKeyboardInput && _coolDownCount <= 0) { _coolDownCount = cooldownTime; RequestExecuteWordToMotionItem?.Invoke(v); } }; _midi.RequestExecuteWordToMotionItem += v => { if (UseMidiInput && _coolDownCount <= 0) { _coolDownCount = cooldownTime; RequestExecuteWordToMotionItem?.Invoke(v); } }; _gamepad.RequestExecuteWordToMotionItem += v => { if (UseGamepadInput && _coolDownCount <= 0) { _coolDownCount = cooldownTime; RequestExecuteWordToMotionItem?.Invoke(v); } }; _wordAnalyzer.WordDetected += word => { if (UseKeyboardWordTypingForWordToMotion) { _coolDownCount = cooldownTime; RequestExecuteWord?.Invoke(word); } }; rawInputChecker.PressedRawKeys.Subscribe(keyName => { if (UseKeyboardWordTypingForWordToMotion) { _count = forgetTime; _wordAnalyzer.Add(KeyName2Char(keyName)); } }); }
public KeyboardToWordToMotion(RawInputChecker rawInputChecker) { _inputObserver = rawInputChecker.PressedRawKeys.Subscribe(keyName => { //NOTE: D0-D8とNumPad系のキーはサニタイズ対象じゃないので、そのまま受け取っても大丈夫 if (_keyToItemIndex.ContainsKey(keyName)) { RequestExecuteWordToMotionItem?.Invoke(_keyToItemIndex[keyName]); } }); }
private void Start() { _rawMouseMoveChecker = GetComponent <RawInputChecker>(); _prevCursosPos = NativeMethods.GetWindowsMousePosition(); }
public HybridInputChecker(RawInputChecker rawInputChecker, GlobalHookInputChecker globalHookInputChecker) { _rawInput = rawInputChecker; _globalHookInput = globalHookInputChecker; }
public void Initialize(IVRMLoadable vrmLoadable, IMessageReceiver receiver, RawInputChecker rawInputChecker) { receiver.AssignCommandHandler( VmmCommands.Chromakey, message => { var argb = message.ToColorFloats(); SetWindowTransparency(argb[0] == 0); }); receiver.AssignCommandHandler( VmmCommands.WindowFrameVisibility, message => SetWindowFrameVisibility(message.ToBoolean()) ); receiver.AssignCommandHandler( VmmCommands.IgnoreMouse, message => SetIgnoreMouseInput(message.ToBoolean()) ); receiver.AssignCommandHandler( VmmCommands.TopMost, message => SetTopMost(message.ToBoolean()) ); receiver.AssignCommandHandler( VmmCommands.WindowDraggable, message => SetWindowDraggable(message.ToBoolean()) ); receiver.AssignCommandHandler( VmmCommands.MoveWindow, message => { int[] xy = message.ToIntArray(); MoveWindow(xy[0], xy[1]); }); receiver.AssignCommandHandler( VmmCommands.ResetWindowSize, _ => ResetWindowSize() ); receiver.AssignCommandHandler( VmmCommands.SetWholeWindowTransparencyLevel, message => SetTransparencyLevel(message.ToInt()) ); receiver.AssignCommandHandler( VmmCommands.SetAlphaValueOnTransparent, message => SetAlphaOnTransparent(message.ToInt()) ); receiver.AssignCommandHandler( VmmCommands.SetVirtualCamBasedWindowSize, message => { int[] wh = message.ToIntArray(); if (wh != null && wh.Length > 1) { SetUnityWindowSize(wh[0], wh[1]); } }); _mouseObserve = rawInputChecker.MouseButton.Subscribe(info => { if (info == "LDown") { ReserveHitTestJudgeOnNextFrame(); } }); vrmLoadable.PreVrmLoaded += info => _renderers = info.renderers; vrmLoadable.VrmDisposing += () => _renderers = new Renderer[0]; }