暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DeltaControl.cs 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using UnityEngine.InputSystem.Layouts;
  2. using UnityEngine.Scripting;
  3. namespace UnityEngine.InputSystem.Controls
  4. {
  5. /// <summary>
  6. /// A control representing a two-dimensional motion vector that accumulates within a frame
  7. /// and resets at the beginning of a frame.
  8. /// </summary>
  9. /// <remarks>
  10. /// Delta controls are
  11. /// </remarks>
  12. /// <see cref="Pointer.delta"/>
  13. /// <seealso cref="Mouse.scroll"/>
  14. [Preserve]
  15. public class DeltaControl : Vector2Control
  16. {
  17. /// <summary>
  18. /// A synthetic axis representing the upper half of the Y axis value, i.e. the 0 to 1 range.
  19. /// </summary>
  20. /// <value>Control representing the control's upper half Y axis.</value>
  21. /// <remarks>
  22. /// The control is marked as <see cref="InputControl.synthetic"/>.
  23. /// </remarks>
  24. [InputControl(useStateFrom = "y", parameters = "clamp=1,clampMin=0,clampMax=3.402823E+38", synthetic = true, displayName = "Up")]
  25. [Preserve]
  26. public AxisControl up { get; set; }
  27. /// <summary>
  28. /// A synthetic axis representing the lower half of the Y axis value, i.e. the -1 to 1 range (inverted).
  29. /// </summary>
  30. /// <value>Control representing the control's lower half Y axis.</value>
  31. /// <remarks>
  32. /// The control is marked as <see cref="InputControl.synthetic"/>.
  33. /// </remarks>
  34. [InputControl(useStateFrom = "y", parameters = "clamp=1,clampMin=-3.402823E+38,clampMax=0,invert", synthetic = true, displayName = "Down")]
  35. [Preserve]
  36. public AxisControl down { get; set; }
  37. /// <summary>
  38. /// A synthetic axis representing the left half of the X axis value, i.e. the -1 to 1 range (inverted).
  39. /// </summary>
  40. /// <value>Control representing the control's left half X axis.</value>
  41. /// <remarks>
  42. /// The control is marked as <see cref="InputControl.synthetic"/>.
  43. /// </remarks>
  44. [InputControl(useStateFrom = "x", parameters = "clamp=1,clampMin=-3.402823E+38,clampMax=0,invert", synthetic = true, displayName = "Left")]
  45. [Preserve]
  46. public AxisControl left { get; set; }
  47. /// <summary>
  48. /// A synthetic axis representing the right half of the X axis value, i.e. the 0 to 1 range.
  49. /// </summary>
  50. /// <value>Control representing the control's right half X axis.</value>
  51. /// <remarks>
  52. /// The control is marked as <see cref="InputControl.synthetic"/>.
  53. /// </remarks>
  54. [InputControl(useStateFrom = "x", parameters = "clamp=1,clampMin=0,clampMax=3.402823E+38", synthetic = true, displayName = "Right")]
  55. [Preserve]
  56. public AxisControl right { get; set; }
  57. protected override void FinishSetup()
  58. {
  59. base.FinishSetup();
  60. up = GetChildControl<AxisControl>("up");
  61. down = GetChildControl<AxisControl>("down");
  62. left = GetChildControl<AxisControl>("left");
  63. right = GetChildControl<AxisControl>("right");
  64. }
  65. }
  66. }