コード例 #1
0
        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));
                }
            });
        }
コード例 #2
0
 public KeyboardToWordToMotion(RawInputChecker rawInputChecker)
 {
     _inputObserver = rawInputChecker.PressedRawKeys.Subscribe(keyName =>
     {
         //NOTE: D0-D8とNumPad系のキーはサニタイズ対象じゃないので、そのまま受け取っても大丈夫
         if (_keyToItemIndex.ContainsKey(keyName))
         {
             RequestExecuteWordToMotionItem?.Invoke(_keyToItemIndex[keyName]);
         }
     });
 }
コード例 #3
0
 private void Start()
 {
     _rawMouseMoveChecker = GetComponent <RawInputChecker>();
     _prevCursosPos       = NativeMethods.GetWindowsMousePosition();
 }
コード例 #4
0
 public HybridInputChecker(RawInputChecker rawInputChecker, GlobalHookInputChecker globalHookInputChecker)
 {
     _rawInput        = rawInputChecker;
     _globalHookInput = globalHookInputChecker;
 }
コード例 #5
0
        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];
        }