mirror of
https://github.com/ppy/osu
synced 2025-01-10 16:19:47 +00:00
Switch from using a constructor argument to using a public field for ShowExtendedTooltip
This commit is contained in:
parent
9a6541356e
commit
060ea1d4fd
@ -36,14 +36,17 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
/// </summary>
|
||||
public bool ShowTooltip { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to include the difficulty stats in the tooltip or not. Defaults to false. Has no effect if <see cref="ShowTooltip"/> is false.
|
||||
/// </summary>
|
||||
public bool ShowExtendedTooltip { get; set; }
|
||||
|
||||
private readonly IBeatmapInfo? beatmap;
|
||||
|
||||
private readonly IRulesetInfo ruleset;
|
||||
|
||||
private readonly Mod[]? mods;
|
||||
|
||||
private readonly bool showExtendedTooltip;
|
||||
|
||||
private Drawable background = null!;
|
||||
|
||||
private readonly Container iconContainer;
|
||||
@ -65,13 +68,11 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
/// <param name="beatmap">The beatmap to be displayed in the tooltip, and to be used for the initial star rating value.</param>
|
||||
/// <param name="mods">An array of mods to account for in the calculations</param>
|
||||
/// <param name="ruleset">An optional ruleset to be used for the icon display, in place of the beatmap's ruleset.</param>
|
||||
/// <param name="showExtendedTooltip">Whether to include the difficulty stats in the tooltip or not. Defaults to false</param>
|
||||
public DifficultyIcon(IBeatmapInfo beatmap, IRulesetInfo? ruleset = null, Mod[]? mods = null, bool showExtendedTooltip = false)
|
||||
public DifficultyIcon(IBeatmapInfo beatmap, IRulesetInfo? ruleset = null, Mod[]? mods = null)
|
||||
: this(ruleset ?? beatmap.Ruleset)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
this.mods = mods;
|
||||
this.showExtendedTooltip = showExtendedTooltip;
|
||||
|
||||
Current.Value = new StarDifficulty(beatmap.StarRating, 0);
|
||||
}
|
||||
@ -138,6 +139,6 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
GetCustomTooltip() => new DifficultyIconTooltip();
|
||||
|
||||
DifficultyIconTooltipContent IHasCustomTooltip<DifficultyIconTooltipContent>.
|
||||
TooltipContent => (ShowTooltip && beatmap != null ? new DifficultyIconTooltipContent(beatmap, Current, ruleset, mods, showExtendedTooltip) : null)!;
|
||||
TooltipContent => (ShowTooltip && beatmap != null ? new DifficultyIconTooltipContent(beatmap, Current, ruleset, mods, ShowExtendedTooltip) : null)!;
|
||||
}
|
||||
}
|
||||
|
@ -283,7 +283,13 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
}
|
||||
|
||||
if (beatmap != null)
|
||||
difficultyIconContainer.Child = new DifficultyIcon(beatmap, ruleset, requiredMods, true) { Size = new Vector2(icon_height) };
|
||||
{
|
||||
difficultyIconContainer.Child = new DifficultyIcon(beatmap, ruleset, requiredMods)
|
||||
{
|
||||
Size = new Vector2(icon_height),
|
||||
ShowExtendedTooltip = true
|
||||
};
|
||||
}
|
||||
else
|
||||
difficultyIconContainer.Clear();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user