1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 05:52:55 +08:00
osu-lazer/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs

47 lines
1.5 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
2018-04-13 17:19:50 +08:00
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.
2018-04-13 17:19:50 +08:00
/// </summary>
public abstract class BeatmapMetadataContainer : OsuHoverContainer
2018-04-13 17:19:50 +08:00
{
private readonly BeatmapInfo beatmap;
protected BeatmapMetadataContainer(BeatmapInfo beatmap)
2018-04-13 17:19:50 +08:00
{
this.beatmap = beatmap;
2019-07-18 19:17:19 +08:00
2018-04-13 17:19:50 +08:00
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader(true)]
private void load(BeatmapSetOverlay beatmapSetOverlay)
2018-04-13 17:19:50 +08:00
{
Action = () =>
{
if (beatmap.OnlineBeatmapID != null)
2018-07-10 15:02:13 +08:00
beatmapSetOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value);
else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null)
beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value);
2018-04-13 17:19:50 +08:00
};
Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Children = CreateText(beatmap),
2018-04-13 17:19:50 +08:00
};
}
protected abstract Drawable[] CreateText(BeatmapInfo beatmap);
2018-04-13 17:19:50 +08:00
}
}