InputUserChange.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. using UnityEngine.InputSystem.LowLevel;
  2. ////REVIEW: how do we handle the case where the OS may (through whatever means) recognize individual real-world users,
  3. //// associate a user account with each one, and recognize when a controller is passed from one user to the other?
  4. //// (NUI on Xbox probably gives us that scenario)
  5. namespace UnityEngine.InputSystem.Users
  6. {
  7. /// <summary>
  8. /// Indicates what type of change related to an <see cref="InputUser"/> occurred.
  9. /// </summary>
  10. /// <seealso cref="InputUser.onChange"/>
  11. public enum InputUserChange
  12. {
  13. /// <summary>
  14. /// A new user was added to the system.
  15. /// </summary>
  16. /// <seealso cref="InputUser.PerformPairingWithDevice"/>
  17. Added,
  18. /// <summary>
  19. /// An existing user was removed from the user.
  20. /// </summary>
  21. /// <remarks>
  22. /// <see cref="InputUser"/>s are only removed when explicitly requested (<see cref="InputUser.UnpairDevicesAndRemoveUser"/>).
  23. /// </remarks>
  24. /// <seealso cref="InputUser.UnpairDevicesAndRemoveUser"/>
  25. Removed,
  26. /// <summary>
  27. /// A user has had a device assigned to it.
  28. /// </summary>
  29. /// <seealso cref="InputUser.PerformPairingWithDevice"/>
  30. /// <seealso cref="InputUser.pairedDevices"/>
  31. DevicePaired,
  32. /// <summary>
  33. /// A user has had a device removed from it.
  34. /// </summary>
  35. /// <remarks>
  36. /// This is different from <see cref="DeviceLost"/> in that the removal is intentional. <see cref="DeviceLost"/>
  37. /// instead indicates that the device was removed due to causes outside of the control of the application (such
  38. /// as battery loss) whereas DeviceUnpaired indicates the device was removed from the user under the control of
  39. /// the application itself.
  40. /// </remarks>
  41. /// <seealso cref="InputUser.UnpairDevice"/>
  42. /// <seealso cref="InputUser.UnpairDevicesAndRemoveUser"/>
  43. /// <seealso cref="InputUser.pairedDevices"/>
  44. DeviceUnpaired,
  45. /// <summary>
  46. /// A device was removed while paired to the user.
  47. /// </summary>
  48. /// <remarks>
  49. /// This scenario happens on battery loss, for example.
  50. ///
  51. /// Note that there is still a <see cref="DevicePaired"/> change sent when the device is subsequently removed
  52. /// from the user.
  53. /// </remarks>
  54. /// <seealso cref="InputUser.pairedDevices"/>
  55. /// <seealso cref="InputUser.lostDevices"/>
  56. DeviceLost,
  57. ////REVIEW: should we tie this to the specific device requirement slot in the control scheme?
  58. /// <summary>
  59. /// A device that was previously lost (<see cref="DeviceLost"/>) was regained by the user.
  60. /// </summary>
  61. /// <remarks>
  62. /// This can happen, for example, when a gamepad runs out of battery and is then plugged in by wire.
  63. ///
  64. /// Note that a device may be permanently lost and instead be replaced by a different device.
  65. /// </remarks>
  66. /// <seealso cref="InputUser.lostDevices"/>
  67. DeviceRegained,
  68. /// <summary>
  69. /// A user has either switched accounts at the platform level.
  70. /// </summary>
  71. /// <remarks>
  72. /// This means that the user is now playing with a different user account. This is relevant for persisting
  73. /// settings as well as for features such as achievements.
  74. ///
  75. /// This is detected via <see cref="DeviceConfigurationEvent"/>s. If a device is currently paired to a user
  76. /// but then notifies that its configuration has changed and the platform user we have on record for the
  77. /// device is no longer the same, this notification is sent after the platform user data (<see cref="InputUser.platformUserAccountHandle"/>
  78. /// and related APIs) has been updated.
  79. ///
  80. /// In response, the application may want to update the user name displayed in the UI. When displaying user
  81. /// profile images, an updated image should also be requested from the platform APIs using the user account
  82. /// information obtained from <see cref="InputUser"/>.
  83. ///
  84. /// Note that the notification may also mean that the device is no longer associated with a user account.
  85. /// In that case <see cref="InputUser.platformUserAccountHandle"/> will be invalid.
  86. /// </remarks>
  87. /// <seealso cref="InputUser.platformUserAccountHandle"/>
  88. /// <seealso cref="InputUser.platformUserAccountName"/>
  89. /// <seealso cref="InputUser.platformUserAccountId"/>
  90. AccountChanged,
  91. AccountNameChanged,
  92. /// <summary>
  93. /// The user was asked to select an account during the device pairing process.
  94. /// </summary>
  95. /// <remarks>
  96. /// In most cases, it makes sense to pause the game while account picking is in progress.
  97. /// </remarks>
  98. AccountSelectionInProgress,
  99. /// <summary>
  100. /// The user canceled the account selection process that was initiated.
  101. /// </summary>
  102. AccountSelectionCanceled,
  103. /// <summary>
  104. /// The user completed the account selection process.
  105. /// </summary>
  106. /// <remarks>
  107. /// Like <see cref="AccountChanged"/>, this means that the account details may have changed.
  108. /// </remarks>
  109. AccountSelectionComplete,
  110. ////REVIEW: send notifications about the matching status of the control scheme? maybe ControlSchemeActivated, ControlSchemeDeactivated,
  111. //// and ControlSchemeChanged?
  112. /// <summary>
  113. /// A user switched to a different control scheme.
  114. /// </summary>
  115. /// <seealso cref="InputUser.ActivateControlScheme(string)"/>
  116. /// <seealso cref="InputUser.ActivateControlScheme(InputControlScheme)"/>
  117. ControlSchemeChanged,
  118. /// <summary>
  119. /// A user's bound controls have changed, either because the bindings of the user have changed (for example,
  120. /// due to an override applied with <see cref="InputActionRebindingExtensions.ApplyBindingOverride(InputAction,InputBinding)"/>)
  121. /// or because the controls themselves may have changed configuration (every time the device of the controls receives
  122. /// an <see cref="DeviceConfigurationEvent"/>; for example, when the current keyboard layout on a <see cref="Keyboard"/>
  123. /// changes which in turn modifies the <see cref="InputControl.displayName"/>s of the keys on the keyboard).
  124. /// </summary>
  125. ControlsChanged,
  126. /*
  127. ////TODO: this is waiting for InputUserSettings
  128. /// <summary>
  129. /// A setting in the user's <see cref="InputUserSettings"/> has changed.
  130. /// </summary>
  131. /// <remarks>
  132. /// This is separate from <see cref="BindingsChanged"/> even though bindings are part of user profiles
  133. /// (<see cref="InputUserSettings.customBindings"/>). The reason is that binding changes often require
  134. /// </remarks>
  135. SettingsChanged,
  136. */
  137. }
  138. }