Esempio n. 1
0
 // Token: 0x06001848 RID: 6216 RVA: 0x00073A54 File Offset: 0x00071C54
 public void Start(Player player, IList <Controller> controllers, InputAction action, AxisRange axisRange)
 {
     this.Stop();
     this.isListening      = true;
     this.currentPlayer    = player;
     this.currentAction    = action;
     this.currentAxisRange = axisRange;
     this.maps             = (from controller in controllers
                              select player.controllers.maps.GetFirstMapInCategory(controller, 0) into map
                              where map != null
                              select map).Distinct <ControllerMap>().ToArray <ControllerMap>();
     Debug.Log(this.maps.Length);
     foreach (ControllerMap controllerMap in this.maps)
     {
         InputMapper.Context mappingContext = new InputMapper.Context
         {
             actionId      = action.id,
             controllerMap = controllerMap,
             actionRange   = this.currentAxisRange
         };
         this.AddInputMapper().Start(mappingContext);
     }
     this.dialogBox = SimpleDialogBox.Create(this.eventSystem);
     this.timer     = this.timeout;
     this.UpdateDialogBoxString();
     RoR2Application.onUpdate += this.Update;
 }
Esempio n. 2
0
 public void SetInputListen(InputMapper.Context context)
 {
     PlayerInput.AllInputBlocked = true;
     _inputMapper.Start(context);
     UIModalQuestion.Set((int i) => {
         PlayerInput.AllInputBlocked = false;
         _inputMapper.Stop();
     }, "Press the new button", "Cancel");
 }
Esempio n. 3
0
 public void RenderKey(int playerId, InputAction inputAction, AxisRange axisRange, ControllerType controllerType, ControllerMap map, ActionElementMap ele)
 {
     this.controllerType = controllerType;
     context             = new InputMapper.Context()
     {
         actionId                  = inputAction.id,
         actionRange               = axisRange,
         controllerMap             = map,
         actionElementMapToReplace = ele
     };
     this.map   = map;
     elementMap = ele;
     RenderKey();
 }
Esempio n. 4
0
        private void RefreshControls()
        {
            Controller controller = PlayerInput.RewiredPlayer.controllers.GetLastActiveController();

            if (controller.type == ControllerType.Mouse)
            {
                controller = PlayerInput.RewiredPlayer.controllers.Keyboard;
            }
            var controllerMap = PlayerInput.RewiredPlayer.controllers.maps.GetFirstMapInCategory(controller, 0);

            foreach (InputAction inputAction in ReInput.mapping.ActionsInCategory(0))
            {
                _targetOptions.Add(SetupLabel(_optionControlsTr, inputAction.descriptiveName).gameObject);
                var pivot = ItemPool.SpawnUIPrefab(_horizontalListPrefab, _optionControlsTr);
                _targetOptions.Add(pivot.gameObject);
                var action = inputAction;
                _targetOptions.Add(SetupButton(pivot.transform, "Add New", delegate(int i) {
                    InputMapper.Context context = new InputMapper.Context()
                    {
                        actionId      = action.id,
                        actionRange   = AxisRange.Positive,
                        controllerMap = controllerMap
                    };
                    SetInputListen(context);
                }).gameObject);
                // Write out assigned elements
                for (var i = 0; i < controllerMap.AllMaps.Count; i++)
                {
                    ActionElementMap elementMap = controllerMap.AllMaps[i];
                    if (elementMap.actionId != action.id)
                    {
                        continue;
                    }
                    _targetOptions.Add(SetupButton(pivot.transform, elementMap.elementIdentifierName, delegate(int i1) {
                        InputMapper.Context context = new InputMapper.Context()
                        {
                            actionId                  = action.id,
                            actionRange               = AxisRange.Positive,
                            controllerMap             = controllerMap,
                            actionElementMapToReplace = elementMap
                        };
                        SetInputListen(context);
                    }).gameObject
                                       );
                }
            }
        }
Esempio n. 5
0
        private void OnInputFieldClicked(int index, int actionElementMapToReplaceId)
        {
            if (index < 0 || index >= this.rows.Count || this.controller == null)
            {
                return;
            }
            InputMapper inputMapper = this.inputMapper;

            InputMapper.Context context1 = new InputMapper.Context();
            context1.set_actionId(this.rows[index].action.get_id());
            context1.set_controllerMap(this.controllerMap);
            context1.set_actionRange(this.rows[index].actionRange);
            context1.set_actionElementMapToReplace(this.controllerMap.GetElementMap(actionElementMapToReplaceId));
            InputMapper.Context context2 = context1;
            inputMapper.Start(context2);
            this.statusUIText.set_text("Listening...");
        }