Beispiel #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));
            });
        }
    }
Beispiel #2
0
        private IEnumerator <WaitCommand> OnExit()
        {
            // Wait for next frame to prevent any input events from the options menu
            // being interpreted by the next state
            yield return(WaitCommand.WaitForNextFrame);

            Fmod.PlayOneShot("event:/ui/back");
        }
Beispiel #3
0
 public void Play(string id)
 {
     for (int i = 0; i < _sounds.Length; i++)
     {
         var sound = _sounds[i];
         if (id.Equals(sound.Id))
         {
             Fmod.PlayOneShot(sound.FmodEventId, Vector3.zero);
         }
     }
 }
Beispiel #4
0
    private IEnumerator <WaitCommand> CompleteRebind(bool isCanceled)
    {
        if (isCanceled)
        {
            Fmod.PlayOneShot("event:/ui/back");
        }
        else
        {
            Fmod.PlayOneShot("event:/ui/forward");
        }

        yield return(WaitCommand.WaitForNextFrame);

        _inputModule.ActivateModule();
        _model.Rebinding = null;
    }