Refactor the extended tooltip variables to be more descriptive

This commit is contained in:
smallketchup82 2024-01-17 13:31:23 -05:00
parent b6422bc8bd
commit 9a6541356e
2 changed files with 11 additions and 11 deletions

View File

@ -42,7 +42,7 @@ namespace osu.Game.Beatmaps.Drawables
private readonly Mod[]? mods; private readonly Mod[]? mods;
private readonly bool showTooltip; private readonly bool showExtendedTooltip;
private Drawable background = null!; private Drawable background = null!;
@ -65,13 +65,13 @@ 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="showTooltip">Whether to display a tooltip on hover. Defaults to false.</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 showTooltip = false) 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.showTooltip = showTooltip; this.showExtendedTooltip = showExtendedTooltip;
Current.Value = new StarDifficulty(beatmap.StarRating, 0); Current.Value = new StarDifficulty(beatmap.StarRating, 0);
} }
@ -138,6 +138,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, showTooltip) : null)!; TooltipContent => (ShowTooltip && beatmap != null ? new DifficultyIconTooltipContent(beatmap, Current, ruleset, mods, showExtendedTooltip) : null)!;
} }
} }

View File

@ -157,10 +157,10 @@ namespace osu.Game.Beatmaps.Drawables
starRating.Current.BindTarget = displayedContent.Difficulty; starRating.Current.BindTarget = displayedContent.Difficulty;
difficultyName.Text = displayedContent.BeatmapInfo.DifficultyName; difficultyName.Text = displayedContent.BeatmapInfo.DifficultyName;
// Don't show difficulty stats if showTooltip is false // Don't show difficulty stats if showExtendedTooltip is false
if (!displayedContent.ShowTooltip) return; if (!displayedContent.ShowExtendedTooltip) return;
// Show the difficulty stats if showTooltip is true // Show the difficulty stats if showExtendedTooltip is true
difficultyFillFlowContainer.Show(); difficultyFillFlowContainer.Show();
miscFillFlowContainer.Show(); miscFillFlowContainer.Show();
@ -212,15 +212,15 @@ namespace osu.Game.Beatmaps.Drawables
public readonly IBindable<StarDifficulty> Difficulty; public readonly IBindable<StarDifficulty> Difficulty;
public readonly IRulesetInfo Ruleset; public readonly IRulesetInfo Ruleset;
public readonly Mod[] Mods; public readonly Mod[] Mods;
public readonly bool ShowTooltip; public readonly bool ShowExtendedTooltip;
public DifficultyIconTooltipContent(IBeatmapInfo beatmapInfo, IBindable<StarDifficulty> difficulty, IRulesetInfo rulesetInfo, Mod[] mods, bool showTooltip = false) public DifficultyIconTooltipContent(IBeatmapInfo beatmapInfo, IBindable<StarDifficulty> difficulty, IRulesetInfo rulesetInfo, Mod[] mods, bool showExtendedTooltip = false)
{ {
BeatmapInfo = beatmapInfo; BeatmapInfo = beatmapInfo;
Difficulty = difficulty; Difficulty = difficulty;
Ruleset = rulesetInfo; Ruleset = rulesetInfo;
Mods = mods; Mods = mods;
ShowTooltip = showTooltip; ShowExtendedTooltip = showExtendedTooltip;
} }
} }
} }