// Token: 0x060022C7 RID: 8903 RVA: 0x000A4350 File Offset: 0x000A2550
        protected void LateUpdate()
        {
            bool flag = this.cursorOpenerCount > 0 && base.currentInputModule && base.currentInputModule.input;

            this.SetCursorIndicatorEnabled(flag);
            MPInputModule mpinputModule = base.currentInputModule as MPInputModule;

            if (flag)
            {
                CursorIndicatorController.CursorSet cursorSet          = this.cursorIndicatorController.noneCursorSet;
                MPEventSystem.InputSource           currentInputSource = this.currentInputSource;
                if (currentInputSource != MPEventSystem.InputSource.Keyboard)
                {
                    if (currentInputSource == MPEventSystem.InputSource.Gamepad)
                    {
                        cursorSet = this.cursorIndicatorController.gamepadCursorSet;
                    }
                }
                else
                {
                    cursorSet = this.cursorIndicatorController.mouseCursorSet;
                }
                this.cursorIndicatorController.SetCursor(cursorSet, this.isHovering ? CursorIndicatorController.CursorImage.Hover : CursorIndicatorController.CursorImage.Pointer, this.GetColor());
                this.cursorIndicatorController.SetPosition(mpinputModule.input.mousePosition);
            }
        }
예제 #2
0
        // Token: 0x06002348 RID: 9032 RVA: 0x0009A2C4 File Offset: 0x000984C4
        public void StartListening()
        {
            this.inputMapperHelper.Stop();
            MPEventSystem eventSystem = this.eventSystemLocator.eventSystem;
            Player        player;

            if (eventSystem == null)
            {
                player = null;
            }
            else
            {
                LocalUser localUser = eventSystem.localUser;
                player = ((localUser != null) ? localUser.inputPlayer : null);
            }
            this.currentPlayer = player;
            if (this.currentPlayer == null)
            {
                return;
            }
            IList <Controller> controllers = null;

            MPEventSystem.InputSource inputSource = this.inputSource;
            if (inputSource != MPEventSystem.InputSource.Keyboard)
            {
                if (inputSource == MPEventSystem.InputSource.Gamepad)
                {
                    controllers = this.currentPlayer.controllers.Joysticks.ToArray <Joystick>();
                }
            }
            else
            {
                controllers = new Controller[]
                {
                    this.currentPlayer.controllers.Keyboard,
                    this.currentPlayer.controllers.Mouse
                };
            }
            this.inputMapperHelper.Start(this.currentPlayer, controllers, this.action, this.axisRange);
            if (this.button)
            {
                this.button.interactable = false;
            }
        }
        // Token: 0x060022C8 RID: 8904 RVA: 0x000A4408 File Offset: 0x000A2608
        private void OnLastActiveControllerChanged(Player player, Controller controller)
        {
            if (controller == null)
            {
                return;
            }
            ControllerType type = controller.type;

            if (type <= ControllerType.Mouse)
            {
                this.currentInputSource = MPEventSystem.InputSource.Keyboard;
                return;
            }
            if (type != ControllerType.Joystick)
            {
                return;
            }
            this.currentInputSource = MPEventSystem.InputSource.Gamepad;
        }
예제 #4
0
        // Token: 0x060017EE RID: 6126 RVA: 0x00072380 File Offset: 0x00070580
        public static string GetGlyphString(MPEventSystem eventSystem, string actionName, AxisRange axisRange, MPEventSystem.InputSource currentInputSource)
        {
            Glyphs.< > c__DisplayClass18_0 CS$ < > 8__locals1;
            CS$ < > 8__locals1.inputPlayer = eventSystem.player;
            InputAction action = ReInput.mapping.GetAction(actionName);

            CS$ < > 8__locals1.inputActionId           = action.id;
            CS$ < > 8__locals1.controllerName          = "Xbox One Controller";
            CS$ < > 8__locals1.controllerType          = (ControllerType)(-1);
            CS$ < > 8__locals1.axisContributionMatters = (axisRange > AxisRange.Full);
            CS$ < > 8__locals1.axisContribution        = Pole.Positive;
            if (axisRange == AxisRange.Negative)
            {
                CS$ < > 8__locals1.axisContribution = Pole.Negative;
            }
            if (currentInputSource != MPEventSystem.InputSource.Keyboard)
            {
                if (currentInputSource != MPEventSystem.InputSource.Gamepad)
                {
                    throw new ArgumentOutOfRangeException();
                }
                CS$ < > 8__locals1.controllerType = ControllerType.Joystick;
                Glyphs.< GetGlyphString > g__SetController | 18_0 (CS$ < > 8__locals1.inputPlayer.controllers.GetLastActiveController(ControllerType.Joystick), ref CS$ < > 8__locals1);
                if (CS$ < > 8__locals1.actionElementMap == null)
                {
                    foreach (Controller controller in CS$ < > 8__locals1.inputPlayer.controllers.Controllers)
                    {
                        if (controller.type == ControllerType.Joystick)
                        {
                            Glyphs.< GetGlyphString > g__SetController | 18_0 (controller, ref CS$ < > 8__locals1);
                            if (CS$ < > 8__locals1.actionElementMap != null)
                            {
                                break;
                            }
                        }
                    }
                }
                if (CS$ < > 8__locals1.actionElementMap == null && eventSystem.localUser != null)
                {
                    using (IEnumerator <ActionElementMap> enumerator2 = eventSystem.localUser.userProfile.joystickMap.ElementMapsWithAction(CS$ < > 8__locals1.inputActionId).GetEnumerator())
                    {
                        if (enumerator2.MoveNext())
                        {
                            ActionElementMap actionElementMap = enumerator2.Current;
                            CS$ < > 8__locals1.actionElementMap = actionElementMap;
                        }
                    }
                }
                if (CS$ < > 8__locals1.actionElementMap == null)
                {
                    return("[NO GAMEPAD BINDING]");
                }
            }
            else
            {
                Glyphs.< GetGlyphString > g__SetController | 18_0 (CS$ < > 8__locals1.inputPlayer.controllers.Keyboard, ref CS$ < > 8__locals1);
                if (CS$ < > 8__locals1.actionElementMap == null)
                {
                    Glyphs.< GetGlyphString > g__SetController | 18_0 (CS$ < > 8__locals1.inputPlayer.controllers.Mouse, ref CS$ < > 8__locals1);
                }
                if (CS$ < > 8__locals1.actionElementMap == null)
                {
                    return("[NO KB/M BINDING]");
                }
            }
            int elementIdentifierId = CS$ < > 8__locals1.actionElementMap.elementIdentifierId;

            Glyphs.GlyphKey key = new Glyphs.GlyphKey(CS$ < > 8__locals1.controllerName, elementIdentifierId);
            string          result;

            if (Glyphs.glyphMap.TryGetValue(key, out result))
            {
                return(result);
            }
            if (CS$ < > 8__locals1.controllerType == ControllerType.Keyboard)
            {
                return(Glyphs.GetKeyboardGlyphString(CS$ < > 8__locals1.actionElementMap.elementIdentifierName));
            }
            if (CS$ < > 8__locals1.controllerType == ControllerType.Mouse)
            {
                string text = CS$ < > 8__locals1.actionElementMap.elementIdentifierName;
                string text2;
                if (Glyphs.mouseElementRenameMap.TryGetValue(text, out text2))
                {
                    text = text2;
                }
                return(text);
            }
            return("UNKNOWN");
        }
예제 #5
0
        private static string GetCustomGlyphString(On.RoR2.Glyphs.orig_GetGlyphString_MPEventSystem_string_AxisRange_InputSource orig, MPEventSystem eventSystem, string actionName, AxisRange axisRange, MPEventSystem.InputSource currentInputSource)
        {
            if (!eventSystem)
            {
                return("???");
            }
            if (isUsingMotionControls)
            {
                Glyphs.resultsList.Clear();
                eventSystem.player.controllers.maps.GetElementMapsWithAction(ControllerType.Custom, Controllers.ControllerID, actionName, false, Glyphs.resultsList);

                if (Glyphs.resultsList.Count() > 0)
                {
                    ActionElementMap displayedMap = Glyphs.resultsList.First();
                    if (displayedMap.elementIdentifierId > 0 && displayedMap.elementIdentifierId < currentGlyphs.Length)
                    {
                        return(currentGlyphs[displayedMap.elementIdentifierId]);
                    }
                }
            }

            return(orig(eventSystem, actionName, axisRange, currentInputSource));
        }