Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #if (UNITY_STANDALONE || UNITY_EDITOR) && UNITY_ENABLE_STEAM_CONTROLLER_SUPPORT
  2. using System;
  3. namespace UnityEngine.InputSystem.Steam
  4. {
  5. /// <summary>
  6. /// A handle for a Steam controller API object typed <typeparamref name="TObject"/>.
  7. /// </summary>
  8. /// <typeparam name="TObject">A type used to type the Steam handle. The type itself isn't used other than
  9. /// for providing type safety to the Steam handle.</typeparam>
  10. public struct SteamHandle<TObject> : IEquatable<SteamHandle<TObject>>
  11. {
  12. private ulong m_Handle;
  13. public SteamHandle(ulong handle)
  14. {
  15. m_Handle = handle;
  16. }
  17. public override string ToString()
  18. {
  19. return string.Format("Steam({0}): {1}", typeof(TObject).Name, m_Handle);
  20. }
  21. public bool Equals(SteamHandle<TObject> other)
  22. {
  23. return m_Handle == other.m_Handle;
  24. }
  25. public override bool Equals(object obj)
  26. {
  27. if (ReferenceEquals(null, obj))
  28. return false;
  29. return obj is SteamHandle<TObject> && Equals((SteamHandle<TObject>)obj);
  30. }
  31. public override int GetHashCode()
  32. {
  33. return m_Handle.GetHashCode();
  34. }
  35. public static bool operator==(SteamHandle<TObject> a, SteamHandle<TObject> b)
  36. {
  37. return a.m_Handle == b.m_Handle;
  38. }
  39. public static bool operator!=(SteamHandle<TObject> a, SteamHandle<TObject> b)
  40. {
  41. return !(a == b);
  42. }
  43. public static explicit operator ulong(SteamHandle<TObject> handle)
  44. {
  45. return handle.m_Handle;
  46. }
  47. }
  48. }
  49. #endif // (UNITY_STANDALONE || UNITY_EDITOR) && UNITY_ENABLE_STEAM_CONTROLLER_SUPPORT