A game about forced loneliness, made by TACStudios
1using System; 2 3////WIP 4 5//how is it achieved that this applies on a per-device level rather than for all devices of a given type? 6//do we do this at the event-level? 7 8 9//where to do perform the input modification? pre-source or post-source? 10//pre-source: 11// + can be persisted such that the outcome is agnostic to user profile settings 12// - no longer possible to have input routed to multiple users from same device 13// 14//post-source: 15// + no need to modify device 16 17////REVIEW: add ability to have per-device (or device layout?) settings? 18 19namespace UnityEngine.InputSystem.Users 20{ 21 /// <summary> 22 /// A user profile may alter select aspects of input behavior at runtime. 23 /// </summary> 24 /// <remarks> 25 /// This class implements several user adjustable input behaviors commonly found in games, such 26 /// as mouse sensitivity and axis inversion. 27 /// 28 /// Note that the behaviors only work in combination with actions, that is, for users that have 29 /// actions associated with them via <see cref="InputUser.AssociateActionsWithUser(IInputActionCollection)"/>. 30 /// The behaviors do not alter the input as present directly on the devices. Meaning that, for example, 31 /// <see cref="invertMouseX"/> will not impact <see cref="Vector2.x"/> of <see cref="Mouse.delta"/> but will 32 /// rather impact the value read out with <see cref="InputAction.CallbackContext.ReadValue"/> from an action 33 /// bound to mouse deltas. 34 /// 35 /// In other words, all the input behaviors operate at the binding level and modify <see cref="InputBinding"/>s. 36 /// ////REVIEW: does this really make sense? 37 /// </remarks> 38 [Serializable] 39 internal class InputUserSettings 40 { 41 /// <summary> 42 /// Customized bindings for the user. 43 /// </summary> 44 /// <remarks> 45 /// This will only contain customizations explicitly applied to the user's bindings 46 /// and will not contain default bindings. It is thus not a complete set of bindings 47 /// but rather just a set of customizations. 48 /// </remarks> 49 public string customBindings { get; set; } 50 51 ////REVIEW: for this to impact position, too, we need to know the screen dimensions 52 /// <summary> 53 /// Invert X on <see cref="Mouse.position"/> and <see cref="Mouse.delta"/>. 54 /// </summary> 55 public bool invertMouseX { get; set; } 56 57 /// <summary> 58 /// Invert Y on <see cref="Mouse.position"/> and <see cref="Mouse.delta"/>. 59 /// </summary> 60 public bool invertMouseY { get; set; } 61 62 /// <summary> 63 /// Smooth mouse motion on both X and Y ... 64 /// </summary> 65 public float? mouseSmoothing { get; set; } 66 67 public float? mouseSensitivity { get; set; } 68 69 /// <summary> 70 /// Invert X axis on <see cref="Gamepad.leftStick"/> and <see cref="Gamepad.rightStick"/>. 71 /// </summary> 72 public bool invertStickX { get; set; } 73 74 /// <summary> 75 /// Invert Y axis on <see cref="Gamepad.leftStick"/> and <see cref="Gamepad.rightStick"/>. 76 /// </summary> 77 public bool invertStickY { get; set; } 78 79 /// <summary> 80 /// If true, swap sides 81 /// </summary> 82 public bool swapSticks { get; set; } 83 84 /// <summary> 85 /// Swap <see cref="Gamepad.leftShoulder"/> and <see cref="Gamepad.rightShoulder"/> on gamepads. 86 /// </summary> 87 public bool swapBumpers { get; set; } 88 89 /// <summary> 90 /// Swap <see cref="Gamepad.leftTrigger"/> and <see cref="Gamepad.rightTrigger"/> on gamepads. 91 /// </summary> 92 public bool swapTriggers { get; set; } 93 94 public bool swapDpadAndLeftStick { get; set; } 95 96 public float vibrationStrength { get; set; } 97 98 public virtual void Apply(IInputActionCollection actions) 99 { 100 //set overrideProcessors and redirectPaths on respective bindings 101 } 102 103 [SerializeField] private string m_CustomBindings; 104 } 105}