mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 14:12:56 +08: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>
|
/// </summary>
|
||||||
public bool ShowTooltip { get; set; } = true;
|
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 IBeatmapInfo? beatmap;
|
||||||
|
|
||||||
private readonly IRulesetInfo ruleset;
|
private readonly IRulesetInfo ruleset;
|
||||||
|
|
||||||
private readonly Mod[]? mods;
|
private readonly Mod[]? mods;
|
||||||
|
|
||||||
private readonly bool showExtendedTooltip;
|
|
||||||
|
|
||||||
private Drawable background = null!;
|
private Drawable background = null!;
|
||||||
|
|
||||||
private readonly Container iconContainer;
|
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="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="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="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)
|
||||||
public DifficultyIcon(IBeatmapInfo beatmap, IRulesetInfo? ruleset = null, Mod[]? mods = null, bool showExtendedTooltip = false)
|
|
||||||
: this(ruleset ?? beatmap.Ruleset)
|
: this(ruleset ?? beatmap.Ruleset)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
this.mods = mods;
|
this.mods = mods;
|
||||||
this.showExtendedTooltip = showExtendedTooltip;
|
|
||||||
|
|
||||||
Current.Value = new StarDifficulty(beatmap.StarRating, 0);
|
Current.Value = new StarDifficulty(beatmap.StarRating, 0);
|
||||||
}
|
}
|
||||||
@ -138,6 +139,6 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
GetCustomTooltip() => new DifficultyIconTooltip();
|
GetCustomTooltip() => new DifficultyIconTooltip();
|
||||||
|
|
||||||
DifficultyIconTooltipContent IHasCustomTooltip<DifficultyIconTooltipContent>.
|
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)
|
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
|
else
|
||||||
difficultyIconContainer.Clear();
|
difficultyIconContainer.Clear();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user