Exemplo n.º 1
0
    public InputSetting(
        ControllerType _controllerType,
        ControllerElementType _elementType,
        int _elementIdentifierId,
        AxisRange _axisRange,
        KeyCode _keyboardKey,
        ModifierKeyFlags _modifierKeyFlags,
        int _actionId,
        Pole _axisContribution,
        bool _invert,
        int _elementMapId)
    {
        int num = 0;

        this.layoutId            = num;
        this.categoryId          = num;
        this.controllerType      = _controllerType;
        this.elementType         = _elementType;
        this.elementIdentifierId = _elementIdentifierId;
        this.axisRange           = _axisRange;
        this.keyboardKey         = _keyboardKey;
        this.modifierKeyFlags    = _modifierKeyFlags;
        this.actionId            = _actionId;
        this.axisContribution    = _axisContribution;
        this.invert       = _invert;
        this.elementMapId = _elementMapId;
    }
Exemplo n.º 2
0
 protected void UpdateStoreValue(ControllerElementType newValue)
 {
     if (!newValue.Equals(storeValue.Value))   // value changed
     // Store new value
     {
         storeValue.Value = newValue;
     }
 }
    public Sprite GetElement(ControllerElementType elementType, int elementID, AxisRange range = AxisRange.Full, Pole axis = Pole.Positive)
    {
        if (elementType == ControllerElementType.Axis)
        {
            return(GetAxis(elementID, range, axis));
        }
        else if (elementType == ControllerElementType.Button)
        {
            return(GetButton(elementID));
        }

        return(null);
    }
    public Sprite GetImage(ControllerType controlType, ControllerElementType elementType, int elementID, AxisRange range = AxisRange.Full, Pole axis = Pole.Positive)
    {
        Sprite image = null;
        int    controllerPlatform = 0;

        if (controlType == ControllerType.Joystick)
        {
            if (lPadInputs.Count == 0)
            {
                return(null);
            }

            if (ControllerStatusManager.currentGamepadType != eGamepadButtonType.Generic)
            {
                if (ControllerStatusManager.nativeGamepadType == eGamepadButtonType.PlayStation3 ||
                    ControllerStatusManager.nativeGamepadType == eGamepadButtonType.PlayStation4)
                {
                    elementID = dPS4InputConverts[elementID];
                }
            }

            // Xbox Controls
            if ((int)ControllerStatusManager.currentGamepadType <= 2)
            {
                controllerPlatform = 0;
            }
            else if ((int)ControllerStatusManager.currentGamepadType < 5)             // PS Controls
            {
                controllerPlatform = 1;
            }
        }

        switch (controlType)
        {
        case ControllerType.Keyboard:
            image = keyInputs.GetElement(ControllerElementType.Button, elementID);
            break;

        case ControllerType.Mouse:
            image = mouseInputs.GetElement(elementType, elementID, range);
            break;

        case ControllerType.Joystick:
            image = lPadInputs[controllerPlatform].GetElement(elementType, elementID, range, axis);
            break;
        }

        return(image);
    }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the string representation of the <see cref="ControllerElementType"/>.
 /// </summary>
 /// <param name="this">The <see cref="ControllerElementType"/> to parse.</param>
 /// <returns>The string representation of the <see cref="ControllerElementType"/>.</returns>
 public static string ToString(this ControllerElementType @this)
 {
     return(Enums.AsString(@this));
 }
 public ControllerElementInfo(string label, ControllerElementType type)
 {
     this.Label = label;
     this.Type  = type;
 }