using System; using System.Collections.Generic; namespace UnityEngine.XR.ARFoundation { /// /// Event arguments for the event. /// public struct ARMeshesChangedEventArgs : IEquatable { /// /// The list of MeshFilters added since the last event. /// public List added { get; private set; } /// /// The list of MeshFilters udpated since the last event. /// public List updated { get; private set; } /// /// The list of MeshFilters removed since the last event. /// public List removed { get; private set; } /// /// Constructs an . /// /// The list of MeshFilters added since the last event. /// The list of MeshFilters updated since the last event. /// The list of MeshFilters removed since the last event. public ARMeshesChangedEventArgs( List added, List updated, List removed) { this.added = added; this.updated = updated; this.removed = removed; } /// /// Generates a hash suitable for use with containers like `HashSet` and `Dictionary`. /// /// A hash code generated from this object's fields. public override int GetHashCode() => HashCodeUtil.Combine( HashCodeUtil.ReferenceHash(added), HashCodeUtil.ReferenceHash(updated), HashCodeUtil.ReferenceHash(removed)); /// /// IEquatable interface. /// /// The object to compare for equality. /// True if is of type /// and compares equal using . public override bool Equals(object obj) { if (!(obj is ARMeshesChangedEventArgs)) return false; return Equals((ARMeshesChangedEventArgs)obj); } /// /// Generates a string representation of this struct, including the number of /// added, updated, and removed meshes. /// /// A string representation of this struct. public override string ToString() { return string.Format("Added: {0}, Updated: {1}, Removed: {2}", added == null ? 0 : added.Count, updated == null ? 0 : updated.Count, removed == null ? 0 : removed.Count); } /// /// Compares for equality. /// /// The to compare for equality. /// True if , , and /// have the same List references as the corresponding properties of . public bool Equals(ARMeshesChangedEventArgs other) { return ReferenceEquals(added, other.added) && ReferenceEquals(updated, other.updated) && ReferenceEquals(removed, other.removed); } /// /// Compares for equality. Same as . /// /// The first to compare. /// The second to compare. /// The same value as public static bool operator ==(ARMeshesChangedEventArgs lhs, ARMeshesChangedEventArgs rhs) { return lhs.Equals(rhs); } /// /// Compares for inequality. Same as !. /// /// The first to compare. /// The second to compare. /// The same value as ! public static bool operator !=(ARMeshesChangedEventArgs lhs, ARMeshesChangedEventArgs rhs) { return !lhs.Equals(rhs); } } }