Add IBeatmapInfo equality support

This commit is contained in:
Dean Herbert
2021-11-12 18:09:45 +09:00
parent 7323f6a50c
commit a67e156883
4 changed files with 40 additions and 1 deletions

View File

@ -98,6 +98,21 @@ namespace osu.Game.Models
#endregion
#region Implementation of IEquatable<IBeatmapInfo>
public bool Equals(IBeatmapInfo? other)
{
if (other is RealmBeatmap b)
return b.ID == ID;
if (OnlineID > 0 && other?.OnlineID > 0)
return other.OnlineID == OnlineID;
return false;
}
#endregion
public bool AudioEquals(RealmBeatmap? other) => other != null
&& BeatmapSet != null
&& other.BeatmapSet != null