mirror of
https://github.com/ppy/osu.git
synced 2025-01-31 20:12:55 +08:00
Show preset description text in tooltip popup
As proposed in https://github.com/ppy/osu/discussions/28610.
This commit is contained in:
parent
17151e81ee
commit
28d5278935
@ -6,6 +6,8 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -17,6 +19,8 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
private const double transition_duration = 200;
|
private const double transition_duration = 200;
|
||||||
|
|
||||||
|
private readonly OsuSpriteText descriptionText;
|
||||||
|
|
||||||
public ModPresetTooltip(OverlayColourProvider colourProvider)
|
public ModPresetTooltip(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
Width = 250;
|
Width = 250;
|
||||||
@ -37,7 +41,15 @@ namespace osu.Game.Overlays.Mods
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding(7),
|
Padding = new MarginPadding(7),
|
||||||
Spacing = new Vector2(7)
|
Spacing = new Vector2(7),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
descriptionText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.GetFont(weight: FontWeight.Regular),
|
||||||
|
Colour = colourProvider.Content2,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -49,8 +61,12 @@ namespace osu.Game.Overlays.Mods
|
|||||||
if (ReferenceEquals(preset, lastPreset))
|
if (ReferenceEquals(preset, lastPreset))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
descriptionText.Text = preset.Description;
|
||||||
|
|
||||||
lastPreset = preset;
|
lastPreset = preset;
|
||||||
Content.ChildrenEnumerable = preset.Mods.AsOrdered().Select(mod => new ModPresetRow(mod));
|
|
||||||
|
Content.RemoveAll(d => d is ModPresetRow, true);
|
||||||
|
Content.AddRange(preset.Mods.AsOrdered().Select(mod => new ModPresetRow(mod)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn() => this.FadeIn(transition_duration, Easing.OutQuint);
|
protected override void PopIn() => this.FadeIn(transition_duration, Easing.OutQuint);
|
||||||
|
Loading…
Reference in New Issue
Block a user