mirror of
https://github.com/ppy/osu
synced 2025-03-05 10:58:34 +00:00
Remove "AllowCreate" function by instead handling nulls
This commit is contained in:
parent
c4aaab20c7
commit
f18b5a3c02
@ -31,12 +31,12 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
protected override APIRequest<List<APIBeatmapSet>> CreateRequest() =>
|
||||
new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
|
||||
|
||||
protected override bool AllowCreate(APIBeatmapSet item) => item.OnlineBeatmapSetID.HasValue;
|
||||
|
||||
protected override Drawable CreateDrawableItem(APIBeatmapSet item) => new DirectGridPanel(item.ToBeatmapSet(Rulesets))
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
};
|
||||
protected override Drawable CreateDrawableItem(APIBeatmapSet item) => !item.OnlineBeatmapSetID.HasValue
|
||||
? null
|
||||
: new DirectGridPanel(item.ToBeatmapSet(Rulesets))
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
return;
|
||||
}
|
||||
|
||||
LoadComponentsAsync(items.Where(AllowCreate).Select(CreateDrawableItem), drawables =>
|
||||
LoadComponentsAsync(items.Select(CreateDrawableItem).Where(d => d != null), drawables =>
|
||||
{
|
||||
missingText.Hide();
|
||||
moreButton.FadeTo(items.Count == ItemsPerPage ? 1 : 0);
|
||||
@ -127,13 +127,6 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to check whether the item is suitable for drawable creation.
|
||||
/// </summary>
|
||||
/// <param name="item">An item to check</param>
|
||||
/// <returns></returns>
|
||||
protected virtual bool AllowCreate(T item) => true;
|
||||
|
||||
protected abstract APIRequest<List<T>> CreateRequest();
|
||||
|
||||
protected abstract Drawable CreateDrawableItem(T item);
|
||||
|
Loading…
Reference in New Issue
Block a user