1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 16:52:57 +08:00
osu-lazer/osu.Game/Beatmaps/Drawables/CalculatingDifficultyIcon.cs
2022-06-24 14:06:31 +09:00

51 lines
1.6 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.Graphics;
using osu.Framework.Graphics.Containers;
using osuTK;
namespace osu.Game.Beatmaps.Drawables
{
/// <summary>
/// A difficulty icon which automatically calculates difficulty in the background.
/// </summary>
public class CalculatingDifficultyIcon : CompositeDrawable
{
/// <summary>
/// Size of this difficulty icon.
/// </summary>
public new Vector2 Size
{
get => difficultyIcon.Size;
set => difficultyIcon.Size = value;
}
public bool ShowTooltip
{
get => difficultyIcon.ShowTooltip;
set => difficultyIcon.ShowTooltip = value;
}
private readonly DifficultyIcon difficultyIcon;
/// <summary>
/// Creates a new <see cref="CalculatingDifficultyIcon"/> that follows the currently-selected ruleset and mods.
/// </summary>
/// <param name="beatmapInfo">The beatmap to show the difficulty of.</param>
public CalculatingDifficultyIcon(IBeatmapInfo beatmapInfo)
{
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
difficultyIcon = new DifficultyIcon(beatmapInfo),
new DelayedLoadUnloadWrapper(() => new DifficultyRetriever(beatmapInfo) { StarDifficulty = { BindTarget = difficultyIcon.Current } }, 0)
{
RelativeSizeAxes = Axes.Both,
}
};
}
}
}