using System; using System.Collections.Generic; using UnityEngine.XR.ARSubsystems; using UnityEngine.XR.Management; namespace UnityEditor.XR.ARSubsystems { /// /// Event arguments for the event. /// public readonly struct PreprocessBuildEventArgs : IEquatable { /// /// The build target which is being built. /// public BuildTarget buildTarget { get; } /// /// The collection of active [XRLoaders](xref:UnityEngine.XR.Management.XRLoader) enabled for /// . /// /// /// Implementors of should check that an /// appropriate loader is present before continuing to execute any preprocessor logic. /// public IReadOnlyList activeLoadersForBuildTarget { get; } /// /// Construct for . /// /// The build target which is being built. /// The collection of active /// [XRLoaders](xref:UnityEngine.XR.Management.XRLoader) enabled for . public PreprocessBuildEventArgs(BuildTarget buildTarget, IReadOnlyList activeLoadersForBuildTarget) => (this.buildTarget, this.activeLoadersForBuildTarget) = (buildTarget, activeLoadersForBuildTarget); /// /// Tests for equality. /// /// The event args to compare for equality. /// `True` if all properties are the same; `false` otherwise. public bool Equals(PreprocessBuildEventArgs other) => buildTarget == other.buildTarget && activeLoadersForBuildTarget?.Equals(other.activeLoadersForBuildTarget) == true; /// /// Tests for equality. /// /// The `object` to compare with this object. /// `True` if is a and /// is `true`, otherwise `false`. public override bool Equals(object obj) => obj is PreprocessBuildEventArgs other && Equals(other); /// /// Computes a hash code from all properties suitable for use in a `Dictionary` or `HashSet`. /// /// Returns a hashcode of this object. public override int GetHashCode() => HashCodeUtil.Combine(((int)buildTarget).GetHashCode(), HashCodeUtil.ReferenceHash(activeLoadersForBuildTarget)); /// /// Tests for equality. Same as . /// /// The left-hand side of the comparison. /// The right-hand side of the comparison. /// Returns the same value as . public static bool operator ==(PreprocessBuildEventArgs lhs, PreprocessBuildEventArgs rhs) => lhs.Equals(rhs); /// /// Tests for inequality. Same as ! /// /// The left-hand side of the comparison. /// The right-hand side of the comparison. /// Returns the negation of . public static bool operator !=(PreprocessBuildEventArgs lhs, PreprocessBuildEventArgs rhs) => !lhs.Equals(rhs); } }