SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
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.

91 lines
3.1 KiB

4 years ago
  1. using System;
  2. using System.Collections.Generic;
  3. namespace UnityEngine.XR.ARFoundation
  4. {
  5. /// <summary>
  6. /// Event arguments for the <see cref="ARAnchorManager.anchorsChanged"/> event.
  7. /// </summary>
  8. public struct ARAnchorsChangedEventArgs : IEquatable<ARAnchorsChangedEventArgs>
  9. {
  10. /// <summary>
  11. /// The list of <see cref="ARAnchor"/>s added since the last event.
  12. /// </summary>
  13. public List<ARAnchor> added { get; private set; }
  14. /// <summary>
  15. /// The list of <see cref="ARAnchor"/>s udpated since the last event.
  16. /// </summary>
  17. public List<ARAnchor> updated { get; private set; }
  18. /// <summary>
  19. /// The list of <see cref="ARAnchor"/>s removed since the last event.
  20. /// At the time the event is invoked, the <see cref="ARAnchor"/>s in
  21. /// this list still exist. They are destroyed immediately afterward.
  22. /// </summary>
  23. public List<ARAnchor> removed { get; private set; }
  24. /// <summary>
  25. /// Constructs an <see cref="ARAnchorsChangedEventArgs"/>.
  26. /// </summary>
  27. /// <param name="added">The list of <see cref="ARAnchor"/>s added since the last event.</param>
  28. /// <param name="updated">The list of <see cref="ARAnchor"/>s updated since the last event.</param>
  29. /// <param name="removed">The list of <see cref="ARAnchor"/>s removed since the last event.</param>
  30. public ARAnchorsChangedEventArgs(
  31. List<ARAnchor> added,
  32. List<ARAnchor> updated,
  33. List<ARAnchor> removed)
  34. {
  35. this.added = added;
  36. this.updated = updated;
  37. this.removed = removed;
  38. }
  39. public override int GetHashCode()
  40. {
  41. unchecked
  42. {
  43. int hash = 0;
  44. hash = hash * 486187739 + (added == null ? 0 : added.GetHashCode());
  45. hash = hash * 486187739 + (updated == null ? 0 : updated.GetHashCode());
  46. hash = hash * 486187739 + (removed == null ? 0 : removed.GetHashCode());
  47. return hash;
  48. }
  49. }
  50. public override bool Equals(object obj)
  51. {
  52. if (!(obj is ARAnchorsChangedEventArgs))
  53. return false;
  54. return Equals((ARAnchorsChangedEventArgs)obj);
  55. }
  56. public override string ToString()
  57. {
  58. return string.Format("Added: {0}, Updated: {1}, Removed: {2}",
  59. added == null ? 0 : added.Count,
  60. updated == null ? 0 : updated.Count,
  61. removed == null ? 0 : removed.Count);
  62. }
  63. public bool Equals(ARAnchorsChangedEventArgs other)
  64. {
  65. return
  66. (added == other.added) &&
  67. (updated == other.updated) &&
  68. (removed == other.removed);
  69. }
  70. public static bool operator ==(ARAnchorsChangedEventArgs lhs, ARAnchorsChangedEventArgs rhs)
  71. {
  72. return lhs.Equals(rhs);
  73. }
  74. public static bool operator !=(ARAnchorsChangedEventArgs lhs, ARAnchorsChangedEventArgs rhs)
  75. {
  76. return !lhs.Equals(rhs);
  77. }
  78. }
  79. }