示例#1
0
    private void InitializeUI()
    {
        IEnumerator enumerator1 = ((Transform)this.actionNameSortArea).GetEnumerator();

        try
        {
            while (enumerator1.MoveNext())
            {
                Object.Destroy((Object)((Component)enumerator1.Current).get_gameObject());
            }
        }
        finally
        {
            if (enumerator1 is IDisposable disposable)
            {
                disposable.Dispose();
            }
        }
        IEnumerator enumerator2 = ((Transform)this.keyInputButtonSortArea).GetEnumerator();

        try
        {
            while (enumerator2.MoveNext())
            {
                Object.Destroy((Object)((Component)enumerator2.Current).get_gameObject());
            }
        }
        finally
        {
            if (enumerator2 is IDisposable disposable)
            {
                disposable.Dispose();
            }
        }
        this.rows.Clear();
        using (IEnumerator <InputAction> enumerator3 = ReInput.get_mapping().ActionsInCategory("Default").GetEnumerator())
        {
            while (((IEnumerator)enumerator3).MoveNext())
            {
                InputAction current = enumerator3.Current;
                if (current.get_userAssignable())
                {
                    if (current.get_type() == 1)
                    {
                        this.CreateUIRow(current, (AxisRange)1, current.get_descriptiveName());
                    }
                    else if (current.get_type() == null)
                    {
                        this.CreateUIRow(current, (AxisRange)0, current.get_descriptiveName());
                        this.CreateUIRow(current, (AxisRange)1, string.IsNullOrEmpty(current.get_positiveDescriptiveName()) ? current.get_descriptiveName() + " +" : current.get_positiveDescriptiveName());
                        this.CreateUIRow(current, (AxisRange)2, string.IsNullOrEmpty(current.get_negativeDescriptiveName()) ? current.get_descriptiveName() + " -" : current.get_negativeDescriptiveName());
                    }
                }
            }
        }
        this.RedrawUI();
    }
示例#2
0
        private void GetAxisButtonDeadZone(int playerId, int actionId, ref float value)
        {
            InputAction action = ReInput.get_mapping().GetAction(actionId);

            if (action == null)
            {
                return;
            }
            int           behaviorId    = action.get_behaviorId();
            InputBehavior inputBehavior = ReInput.get_mapping().GetInputBehavior(playerId, behaviorId);

            if (inputBehavior == null)
            {
                return;
            }
            value = inputBehavior.get_buttonDeadZone() + 0.1f;
        }
示例#3
0
        private void DrawActiveElements()
        {
            for (int index = 0; index < this._uiElementsArray.Length; ++index)
            {
                this._uiElementsArray[index].element.Deactivate();
            }
            for (int index = 0; index < this._sticks.Length; ++index)
            {
                this._sticks[index].Reset();
            }
            IList <InputAction> actions = ReInput.get_mapping().get_Actions();

            for (int index = 0; index < ((ICollection <InputAction>)actions).Count; ++index)
            {
                this.ActivateElements(this.player, actions[index].get_id());
            }
        }
示例#4
0
 private void LogActionMap()
 {
     using (IEnumerator <InputAction> enumerator = ((IEnumerable <InputAction>)ReInput.get_mapping().get_Actions()).GetEnumerator())
     {
         while (((IEnumerator)enumerator).MoveNext())
         {
             InputAction current = enumerator.Current;
             Debug.Log((object)"↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓");
             Debug.Log((object)("ID → " + (object)current.get_id()));
             Debug.Log((object)("Name → " + current.get_name()));
             Debug.Log((object)("Type → " + (object)current.get_type()));
             Debug.Log((object)("DescriptiveName → " + current.get_descriptiveName()));
             Debug.Log((object)("PositiveDescriptiveName → " + current.get_positiveDescriptiveName()));
             Debug.Log((object)("NegativeDescriptiveName → " + current.get_negativeDescriptiveName()));
             Debug.Log((object)("BehaviorID → " + (object)current.get_behaviorId()));
             Debug.Log((object)("CategoryID → " + (object)current.get_categoryId()));
             Debug.Log((object)("UserAssignble → " + (object)current.get_userAssignable()));
             Debug.Log((object)"↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑");
         }
     }
 }
示例#5
0
 public void SetJoystick(int playerId, Joystick joystick)
 {
     if (!this.initialized)
     {
         return;
     }
     this.playerId = playerId;
     this.joystick = joystick;
     if (joystick == null)
     {
         Debug.LogError((object)"Rewired Control Mapper: Joystick cannot be null!");
     }
     else
     {
         float num = 0.0f;
         for (int index = 0; index < ((ControllerWithAxes)joystick).get_axisCount(); ++index)
         {
             // ISSUE: object of a compiler-generated type is created
             // ISSUE: variable of a compiler-generated type
             CalibrationWindow.\u003CSetJoystick\u003Ec__AnonStorey0 joystickCAnonStorey0 = new CalibrationWindow.\u003CSetJoystick\u003Ec__AnonStorey0();
             // ISSUE: reference to a compiler-generated field
             joystickCAnonStorey0.\u0024this = this;
             // ISSUE: reference to a compiler-generated field
             joystickCAnonStorey0.index = index;
             GameObject gameObject = UITools.InstantiateGUIObject <Button>(this.axisButtonPrefab, (Transform)this.axisScrollAreaContent, "Axis" + (object)index);
             // ISSUE: reference to a compiler-generated field
             joystickCAnonStorey0.button = (Button)gameObject.GetComponent <Button>();
             // ISSUE: reference to a compiler-generated field
             // ISSUE: method pointer
             ((UnityEvent)joystickCAnonStorey0.button.get_onClick()).AddListener(new UnityAction((object)joystickCAnonStorey0, __methodptr(\u003C\u003Em__0)));
             Text inSelfOrChildren = (Text)UnityTools.GetComponentInSelfOrChildren <Text>(gameObject);
             if (Object.op_Inequality((Object)inSelfOrChildren, (Object)null))
             {
                 inSelfOrChildren.set_text(((ControllerWithAxes)joystick).get_AxisElementIdentifiers()[index].get_name());
             }
             if ((double)num == 0.0)
             {
                 num = ((LayoutElement)UnityTools.GetComponentInSelfOrChildren <LayoutElement>(gameObject)).get_minHeight();
             }
             // ISSUE: reference to a compiler-generated field
             this.axisButtons.Add(joystickCAnonStorey0.button);
         }
         float spacing = ((HorizontalOrVerticalLayoutGroup)((Component)this.axisScrollAreaContent).GetComponent <VerticalLayoutGroup>()).get_spacing();
         this.axisScrollAreaContent.set_sizeDelta(new Vector2((float)this.axisScrollAreaContent.get_sizeDelta().x, Mathf.Max((float)((ControllerWithAxes)joystick).get_axisCount() * (num + spacing) - spacing, (float)this.axisScrollAreaContent.get_sizeDelta().y)));
         this.origCalibrationData          = ((ControllerWithAxes)joystick).get_calibrationMap().ToXmlString();
         this.displayAreaWidth             = (float)this.rightContentContainer.get_sizeDelta().x;
         this.rewiredStandaloneInputModule = (RewiredStandaloneInputModule)((Component)((Component)this).get_gameObject().get_transform().get_root()).GetComponentInChildren <RewiredStandaloneInputModule>();
         if (Object.op_Inequality((Object)this.rewiredStandaloneInputModule, (Object)null))
         {
             this.menuHorizActionId = ReInput.get_mapping().GetActionId(this.rewiredStandaloneInputModule.horizontalAxis);
             this.menuVertActionId  = ReInput.get_mapping().GetActionId(this.rewiredStandaloneInputModule.verticalAxis);
         }
         if (((ControllerWithAxes)joystick).get_axisCount() > 0)
         {
             this.SelectAxis(0);
         }
         this.defaultUIElement = ((Component)this.doneButton).get_gameObject();
         this.RefreshControls();
         this.Redraw();
     }
 }
示例#6
0
 private InputBehavior GetInputBehavior(int id)
 {
     return(ReInput.get_mapping().GetInputBehavior(this.playerId, id));
 }
示例#7
0
        private void InitializeUI()
        {
            IEnumerator enumerator1 = ((Transform)this.actionGroupTransform).GetEnumerator();

            try
            {
                while (enumerator1.MoveNext())
                {
                    Object.Destroy((Object)((Component)enumerator1.Current).get_gameObject());
                }
            }
            finally
            {
                if (enumerator1 is IDisposable disposable)
                {
                    disposable.Dispose();
                }
            }
            IEnumerator enumerator2 = ((Transform)this.fieldGroupTransform).GetEnumerator();

            try
            {
                while (enumerator2.MoveNext())
                {
                    Object.Destroy((Object)((Component)enumerator2.Current).get_gameObject());
                }
            }
            finally
            {
                if (enumerator2 is IDisposable disposable)
                {
                    disposable.Dispose();
                }
            }
            using (IEnumerator <InputAction> enumerator3 = ((IEnumerable <InputAction>)ReInput.get_mapping().get_Actions()).GetEnumerator())
            {
                while (((IEnumerator)enumerator3).MoveNext())
                {
                    InputAction current = enumerator3.Current;
                    if (current.get_type() == null)
                    {
                        this.CreateUIRow(current, (AxisRange)0, current.get_descriptiveName());
                        this.CreateUIRow(current, (AxisRange)1, string.IsNullOrEmpty(current.get_positiveDescriptiveName()) ? current.get_descriptiveName() + " +" : current.get_positiveDescriptiveName());
                        this.CreateUIRow(current, (AxisRange)2, string.IsNullOrEmpty(current.get_negativeDescriptiveName()) ? current.get_descriptiveName() + " -" : current.get_negativeDescriptiveName());
                    }
                    else if (current.get_type() == 1)
                    {
                        this.CreateUIRow(current, (AxisRange)1, current.get_descriptiveName());
                    }
                }
            }
            this.RedrawUI();
        }