mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 11:42:54 +08:00
Remove newly added equality
This commit is contained in:
parent
a4c11e8813
commit
0b4822b552
@ -163,20 +163,6 @@ namespace osu.Game.Beatmaps
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Equals(IBeatmapInfo other)
|
||||
{
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
if (other == null) return false;
|
||||
|
||||
if (other is BeatmapInfo b && Equals(b))
|
||||
return true;
|
||||
|
||||
if (OnlineID > 0 && other.OnlineID > 0)
|
||||
return other.OnlineID == OnlineID;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
|
||||
BeatmapSet.Hash == other.BeatmapSet.Hash &&
|
||||
(Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile;
|
||||
|
@ -78,20 +78,6 @@ namespace osu.Game.Beatmaps
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Equals(IBeatmapSetInfo other)
|
||||
{
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
if (other == null) return false;
|
||||
|
||||
if (other is BeatmapSetInfo b && Equals(b))
|
||||
return true;
|
||||
|
||||
if (OnlineID > 0 && other.OnlineID > 0)
|
||||
return other.OnlineID == OnlineID;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#region Implementation of IHasOnlineID
|
||||
|
||||
int IHasOnlineID<int>.OnlineID => OnlineID ?? -1;
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
@ -12,7 +11,7 @@ namespace osu.Game.Beatmaps
|
||||
/// <summary>
|
||||
/// A single beatmap difficulty.
|
||||
/// </summary>
|
||||
public interface IBeatmapInfo : IHasOnlineID<int>, IEquatable<IBeatmapInfo>
|
||||
public interface IBeatmapInfo : IHasOnlineID<int>
|
||||
{
|
||||
/// <summary>
|
||||
/// The user-specified name given to this beatmap.
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps
|
||||
/// <summary>
|
||||
/// A representation of a collection of beatmap difficulties, generally packaged as an ".osz" archive.
|
||||
/// </summary>
|
||||
public interface IBeatmapSetInfo : IHasOnlineID<int>, IEquatable<IBeatmapSetInfo>
|
||||
public interface IBeatmapSetInfo : IHasOnlineID<int>
|
||||
{
|
||||
/// <summary>
|
||||
/// The date when this beatmap was imported.
|
||||
|
@ -106,27 +106,6 @@ namespace osu.Game.Models
|
||||
return ID == other.ID;
|
||||
}
|
||||
|
||||
#region Implementation of IEquatable<IBeatmapInfo>
|
||||
|
||||
public bool Equals(IBeatmapInfo? other)
|
||||
{
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
if (other == null) return false;
|
||||
|
||||
if (other is RealmBeatmap b && Equals(b))
|
||||
return true;
|
||||
|
||||
if (!string.IsNullOrEmpty(Hash) && !string.IsNullOrEmpty(other.Hash))
|
||||
return Hash == other.Hash;
|
||||
|
||||
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
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using Realms;
|
||||
|
||||
#nullable enable
|
||||
@ -61,21 +62,7 @@ namespace osu.Game.Models
|
||||
return ID == other.ID;
|
||||
}
|
||||
|
||||
public bool Equals(IBeatmapSetInfo? other)
|
||||
{
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
if (other == null) return false;
|
||||
|
||||
if (other is RealmBeatmapSet b && Equals(b))
|
||||
return true;
|
||||
|
||||
if (OnlineID > 0 && other.OnlineID > 0)
|
||||
return OnlineID == other.OnlineID;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override string ToString() => Metadata?.ToString() ?? base.ToString();
|
||||
public override string ToString() => Metadata?.GetDisplayString() ?? base.ToString();
|
||||
|
||||
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user