mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Add IBeatmapInfo
equality support
This commit is contained in:
@ -151,6 +151,17 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public override string ToString() => this.GetDisplayTitle();
|
||||
|
||||
public bool Equals(IBeatmapInfo other)
|
||||
{
|
||||
if (other is BeatmapInfo b)
|
||||
return Equals(b);
|
||||
|
||||
if (OnlineID > 0 && other?.OnlineID > 0)
|
||||
return other.OnlineID == OnlineID;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Equals(BeatmapInfo other)
|
||||
{
|
||||
if (ID == 0 || other?.ID == 0)
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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;
|
||||
|
||||
@ -11,7 +12,7 @@ namespace osu.Game.Beatmaps
|
||||
/// <summary>
|
||||
/// A single beatmap difficulty.
|
||||
/// </summary>
|
||||
public interface IBeatmapInfo : IHasOnlineID<int>
|
||||
public interface IBeatmapInfo : IHasOnlineID<int>, IEquatable<IBeatmapInfo>
|
||||
{
|
||||
/// <summary>
|
||||
/// The user-specified name given to this beatmap.
|
||||
|
Reference in New Issue
Block a user