mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:37:28 +08:00
Fix beatmap listing potentially showing duplicate beatmap cards
This commit is contained in:
parent
a5b962d9a3
commit
07f577a0c6
@ -14,7 +14,7 @@ using osu.Game.Overlays;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables.Cards
|
namespace osu.Game.Beatmaps.Drawables.Cards
|
||||||
{
|
{
|
||||||
public abstract class BeatmapCard : OsuClickableContainer
|
public abstract class BeatmapCard : OsuClickableContainer, IEquatable<BeatmapCard>
|
||||||
{
|
{
|
||||||
public const float TRANSITION_DURATION = 400;
|
public const float TRANSITION_DURATION = 400;
|
||||||
public const float CORNER_RADIUS = 10;
|
public const float CORNER_RADIUS = 10;
|
||||||
@ -96,5 +96,16 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
|||||||
throw new ArgumentOutOfRangeException(nameof(size), size, @"Unsupported card size");
|
throw new ArgumentOutOfRangeException(nameof(size), size, @"Unsupported card size");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Equals(BeatmapCard? other)
|
||||||
|
{
|
||||||
|
if (ReferenceEquals(null, other)) return false;
|
||||||
|
if (ReferenceEquals(this, other)) return true;
|
||||||
|
|
||||||
|
return BeatmapSet.Equals(other.BeatmapSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj) => obj is BeatmapCard other && Equals(other);
|
||||||
|
public override int GetHashCode() => BeatmapSet.GetHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,8 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
newCards = newCards.Except(foundContent);
|
||||||
|
|
||||||
panelLoadTask = LoadComponentsAsync(newCards, loaded =>
|
panelLoadTask = LoadComponentsAsync(newCards, loaded =>
|
||||||
{
|
{
|
||||||
lastFetchDisplayedTime = Time.Current;
|
lastFetchDisplayedTime = Time.Current;
|
||||||
@ -185,7 +187,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapCard[] createCardsFor(IEnumerable<APIBeatmapSet> beatmapSets) => beatmapSets.Select(set => BeatmapCard.Create(set, filterControl.CardSize.Value).With(c =>
|
private IEnumerable<BeatmapCard> createCardsFor(IEnumerable<APIBeatmapSet> beatmapSets) => beatmapSets.Select(set => BeatmapCard.Create(set, filterControl.CardSize.Value).With(c =>
|
||||||
{
|
{
|
||||||
c.Anchor = Anchor.TopCentre;
|
c.Anchor = Anchor.TopCentre;
|
||||||
c.Origin = Anchor.TopCentre;
|
c.Origin = Anchor.TopCentre;
|
||||||
|
Loading…
Reference in New Issue
Block a user