예제 #1
0
    private IEnumerator <WaitCommand> StartRebindInternal(InputBindingViewModel binding)
    {
        var bindingId = binding.Id;

        // TODO Update selected binding in the menu model
        Fmod.PlayOneShot("event:/ui/forward");
        // Disable menu input to view
        //_mouseInputToView.Disable();
        _inputModule.DeactivateModule();

        yield return(WaitCommand.WaitForNextFrame);

        _model.Rebinding = binding;

        if (bindingId.Group == InputBindingGroup.Menu)
        {
            MenuAction menuAction = (MenuAction)bindingId.ActionId;
            _inputRebinder.StartRebind(inputSource => {
                if (inputSource.IsJust)
                {
                    _menuInputBindings.UpdateMapping(menuAction, inputSource.Value);
                }
                _coroutineScheduler.Run(CompleteRebind(isCanceled: inputSource.IsNothing));
            });
        }
        else if (bindingId.Group == InputBindingGroup.Wingsuit)
        {
            WingsuitAction pilotAction = (WingsuitAction)bindingId.ActionId;
            _inputRebinder.StartRebind(inputSource => {
                if (inputSource.IsJust)
                {
                    _pilotInputBindings.UpdateMapping(pilotAction, inputSource.Value);
                }
                _coroutineScheduler.Run(CompleteRebind(isCanceled: inputSource.IsNothing));
            });
        }
        else if (bindingId.Group == InputBindingGroup.Spectator)
        {
            SpectatorAction spectatorAction = (SpectatorAction)bindingId.ActionId;
            _inputRebinder.StartRebind(inputSource => {
                if (inputSource.IsJust)
                {
                    _spectatorInputBindings.UpdateMapping(spectatorAction, inputSource.Value);
                }
                _coroutineScheduler.Run(CompleteRebind(isCanceled: inputSource.IsNothing));
            });
        }
        else if (bindingId.Group == InputBindingGroup.Parachute)
        {
            ParachuteAction parachuteAction = (ParachuteAction)bindingId.ActionId;
            _inputRebinder.StartRebind(inputSource => {
                if (inputSource.IsJust)
                {
                    _parachuteInputBindings.UpdateMapping(parachuteAction, inputSource.Value);
                }
                _coroutineScheduler.Run(CompleteRebind(isCanceled: inputSource.IsNothing));
            });
        }
    }
예제 #2
0
    public static int DeactivateModule(IntPtr l)
    {
        int result;

        try
        {
            BaseInputModule baseInputModule = (BaseInputModule)LuaObject.checkSelf(l);
            baseInputModule.DeactivateModule();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }