1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 09:17:48 +08:00
osu-lazer/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs
2023-01-01 23:49:11 +01:00

44 lines
1.3 KiB
C#

// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Profile.Sections
{
/// <summary>
/// Display artist/title/mapper information, commonly used as the left portion of a profile or score display row.
/// </summary>
public abstract partial class BeatmapMetadataContainer : OsuHoverContainer
{
private readonly IBeatmapInfo beatmapInfo;
protected BeatmapMetadataContainer(IBeatmapInfo beatmapInfo)
{
this.beatmapInfo = beatmapInfo;
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(BeatmapSetOverlay? beatmapSetOverlay)
{
Action = () =>
{
beatmapSetOverlay?.FetchAndShowBeatmap(beatmapInfo.OnlineID);
};
Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Children = CreateText(beatmapInfo),
};
}
protected abstract Drawable[] CreateText(IBeatmapInfo beatmapInfo);
}
}