2021-10-18 02:50:44 +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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2021-10-18 02:50:44 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Cursor;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Framework.Localisation;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Overlays;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Drawables.Cards.Statistics
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// A single statistic shown on a beatmap card.
|
|
|
|
/// </summary>
|
2022-11-24 13:32:20 +08:00
|
|
|
public abstract partial class BeatmapCardStatistic : CompositeDrawable, IHasTooltip, IHasCustomTooltip
|
2021-10-18 02:50:44 +08:00
|
|
|
{
|
|
|
|
protected IconUsage Icon
|
|
|
|
{
|
|
|
|
get => spriteIcon.Icon;
|
|
|
|
set => spriteIcon.Icon = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected LocalisableString Text
|
|
|
|
{
|
|
|
|
get => spriteText.Text;
|
|
|
|
set => spriteText.Text = value;
|
|
|
|
}
|
|
|
|
|
2021-11-08 12:22:57 +08:00
|
|
|
public LocalisableString TooltipText { get; protected set; }
|
2021-10-18 02:50:44 +08:00
|
|
|
|
|
|
|
private readonly SpriteIcon spriteIcon;
|
|
|
|
private readonly OsuSpriteText spriteText;
|
|
|
|
|
|
|
|
protected BeatmapCardStatistic()
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
InternalChild = new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
Spacing = new Vector2(5, 0),
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
spriteIcon = new SpriteIcon
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
Size = new Vector2(10),
|
|
|
|
Margin = new MarginPadding { Top = 1 }
|
|
|
|
},
|
|
|
|
spriteText = new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
Font = OsuFont.Default.With(size: 14)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
|
|
|
{
|
|
|
|
spriteIcon.Colour = colourProvider.Content2;
|
|
|
|
}
|
|
|
|
|
|
|
|
#region Tooltip implementation
|
|
|
|
|
2023-11-09 21:27:29 +08:00
|
|
|
public virtual ITooltip GetCustomTooltip() => null!;
|
2021-10-18 02:50:44 +08:00
|
|
|
public virtual object TooltipContent => null;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|