using System;
using System.Collections.Generic;
namespace UnityEngine.XR.ARFoundation
{
///
/// Event arguments for the event.
///
[Obsolete("ARParticipantsChangedEventArgs has been deprecated in AR Foundation version 6.0. Use ARTrackablesChangedEventArgs instead.", false)]
public struct ARParticipantsChangedEventArgs : IEquatable
{
///
/// The list of s added since the last event.
///
public List added { get; private set; }
///
/// The list of s udpated since the last event.
///
public List updated { get; private set; }
///
/// The list of s removed since the last event.
///
public List removed { get; private set; }
///
/// Constructs an .
///
/// The list of s added since the last event.
/// The list of s updated since the last event.
/// The list of s removed since the last event.
public ARParticipantsChangedEventArgs(
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));
///
/// Tests for equality.
///
/// The `object` to compare against.
/// `True` if is of type and
/// also returns `true`; otherwise `false`.
public override bool Equals(object obj) => (obj is ARParticipantsChangedEventArgs) && Equals((ARParticipantsChangedEventArgs)obj);
int GetCount(List list) => list != null ? list.Count : 0;
///
/// Generates a string suitable for debugging. The string contains the number of added, updated, and removed participants.
///
/// A string suitable for debug logging.
public override string ToString() => $"Added: {GetCount(added)}, Updated: {GetCount(updated)}, Removed: {GetCount(removed)}";
///
/// Tests for equality.
///
/// The other to compare against.
/// true if is equal to this .
public bool Equals(ARParticipantsChangedEventArgs other)
{
return
ReferenceEquals(added, other.added) &&
ReferenceEquals(updated, other.updated) &&
ReferenceEquals(removed, other.removed);
}
///
/// Tests for equality. Same as .
///
/// The left-hand side of the comparison.
/// The right-hand side of the comparison.
/// true if is equal to .
public static bool operator ==(ARParticipantsChangedEventArgs lhs, ARParticipantsChangedEventArgs rhs) => lhs.Equals(rhs);
///
/// Tests for inequality. Same as !.
///
/// The left-hand side of the comparison.
/// The right-hand side of the comparison.
/// true if is not equal to .
public static bool operator !=(ARParticipantsChangedEventArgs lhs, ARParticipantsChangedEventArgs rhs) => !lhs.Equals(rhs);
}
}