mirror of
https://github.com/ppy/osu
synced 2024-12-17 04:15:37 +00:00
Allow for difficulty icon to have content added near the icon (#5822)
Allow for difficulty icon to have content added near the icon Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
509efacf9d
@ -19,23 +19,33 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
{
|
{
|
||||||
public class DifficultyIcon : Container, IHasCustomTooltip
|
public class DifficultyIcon : CompositeDrawable, IHasCustomTooltip
|
||||||
{
|
{
|
||||||
private readonly BeatmapInfo beatmap;
|
private readonly BeatmapInfo beatmap;
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
|
|
||||||
|
private readonly Container iconContainer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Size of this difficulty icon.
|
||||||
|
/// </summary>
|
||||||
|
public new Vector2 Size
|
||||||
|
{
|
||||||
|
get => iconContainer.Size;
|
||||||
|
set => iconContainer.Size = value;
|
||||||
|
}
|
||||||
|
|
||||||
public DifficultyIcon(BeatmapInfo beatmap, RulesetInfo ruleset = null, bool shouldShowTooltip = true)
|
public DifficultyIcon(BeatmapInfo beatmap, RulesetInfo ruleset = null, bool shouldShowTooltip = true)
|
||||||
{
|
{
|
||||||
if (beatmap == null)
|
this.beatmap = beatmap ?? throw new ArgumentNullException(nameof(beatmap));
|
||||||
throw new ArgumentNullException(nameof(beatmap));
|
|
||||||
|
|
||||||
this.beatmap = beatmap;
|
|
||||||
|
|
||||||
this.ruleset = ruleset ?? beatmap.Ruleset;
|
this.ruleset = ruleset ?? beatmap.Ruleset;
|
||||||
if (shouldShowTooltip)
|
if (shouldShowTooltip)
|
||||||
TooltipContent = beatmap;
|
TooltipContent = beatmap;
|
||||||
|
|
||||||
Size = new Vector2(20);
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChild = iconContainer = new Container { Size = new Vector2(20f) };
|
||||||
}
|
}
|
||||||
|
|
||||||
public string TooltipText { get; set; }
|
public string TooltipText { get; set; }
|
||||||
@ -47,7 +57,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
iconContainer.Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new CircularContainer
|
new CircularContainer
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user