2020-08-01 12:04:39 +08:00
|
|
|
|
// 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.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2021-11-01 15:02:00 +08:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2020-08-01 12:04:39 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
|
2020-08-03 02:47:09 +08:00
|
|
|
|
namespace osu.Game.Overlays.Dashboard.Home
|
2020-08-01 12:04:39 +08:00
|
|
|
|
{
|
2020-08-03 02:33:14 +08:00
|
|
|
|
public abstract class DrawableBeatmapList : CompositeDrawable
|
2020-08-01 12:04:39 +08:00
|
|
|
|
{
|
2021-11-01 15:02:00 +08:00
|
|
|
|
private readonly List<APIBeatmapSet> beatmapSets;
|
2020-08-01 12:04:39 +08:00
|
|
|
|
|
2021-11-01 15:02:00 +08:00
|
|
|
|
protected DrawableBeatmapList(List<APIBeatmapSet> beatmapSets)
|
2020-08-01 12:04:39 +08:00
|
|
|
|
{
|
2021-11-01 15:02:00 +08:00
|
|
|
|
this.beatmapSets = beatmapSets;
|
2020-08-01 12:04:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
|
|
|
|
{
|
|
|
|
|
FillFlowContainer flow;
|
|
|
|
|
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
InternalChild = flow = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Spacing = new Vector2(0, 10),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold),
|
|
|
|
|
Colour = colourProvider.Light1,
|
2020-08-03 02:44:34 +08:00
|
|
|
|
Text = Title
|
2020-08-01 12:04:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-01 15:02:00 +08:00
|
|
|
|
flow.AddRange(beatmapSets.Select(CreateBeatmapPanel));
|
2020-08-01 12:04:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-03 02:35:24 +08:00
|
|
|
|
protected abstract string Title { get; }
|
2020-08-01 12:04:39 +08:00
|
|
|
|
|
2021-11-01 15:02:00 +08:00
|
|
|
|
protected abstract DashboardBeatmapPanel CreateBeatmapPanel(APIBeatmapSet beatmapSet);
|
2020-08-01 12:04:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|