Açıklama Yok
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.

DeviceResetEvent.cs 1.3KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Runtime.InteropServices;
  2. using UnityEngine.InputSystem.Utilities;
  3. namespace UnityEngine.InputSystem.LowLevel
  4. {
  5. /// <summary>
  6. /// Event that causes the state of an <see cref="InputDevice"/> to be reset (see <see cref="InputSystem.ResetDevice"/>).
  7. /// </summary>
  8. /// <seealso cref="InputSystem.ResetDevice"/>
  9. [StructLayout(LayoutKind.Explicit, Size = InputEvent.kBaseEventSize)]
  10. public struct DeviceResetEvent : IInputEventTypeInfo
  11. {
  12. public const int Type = 0x44525354; // DRST
  13. /// <summary>
  14. /// Common event data.
  15. /// </summary>
  16. [FieldOffset(0)]
  17. public InputEvent baseEvent;
  18. /// <summary>
  19. /// Whether to also reset <see cref="Layouts.InputControlAttribute.dontReset"/> controls.
  20. /// </summary>
  21. [FieldOffset(InputDeviceCommand.kBaseCommandSize)]
  22. public bool hardReset;
  23. public FourCC typeStatic => Type;
  24. public static DeviceResetEvent Create(int deviceId, bool hardReset = false, double time = -1)
  25. {
  26. var inputEvent =
  27. new DeviceResetEvent {baseEvent = new InputEvent(Type, InputEvent.kBaseEventSize, deviceId, time)};
  28. inputEvent.hardReset = hardReset;
  29. return inputEvent;
  30. }
  31. }
  32. }