1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 16:19:35 +08:00

Merge pull request #22671 from peppy/blueprint-labels-while-hovering

Only show skin blueprint labels when selected or hovering
This commit is contained in:
Bartłomiej Dach 2023-02-18 16:29:37 +01:00 committed by GitHub
commit 79e1dbfb6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
@ -25,6 +26,8 @@ namespace osu.Game.Overlays.SkinEditor
private AnchorOriginVisualiser anchorOriginVisualiser = null!; private AnchorOriginVisualiser anchorOriginVisualiser = null!;
private OsuSpriteText label = null!;
private Drawable drawable => (Drawable)Item; private Drawable drawable => (Drawable)Item;
protected override bool ShouldBeAlive => drawable.IsAlive && Item.IsPresent; protected override bool ShouldBeAlive => drawable.IsAlive && Item.IsPresent;
@ -62,7 +65,7 @@ namespace osu.Game.Overlays.SkinEditor
}, },
} }
}, },
new OsuSpriteText label = new OsuSpriteText
{ {
Text = Item.GetType().Name, Text = Item.GetType().Name,
Font = OsuFont.Default.With(size: 10, weight: FontWeight.Bold), Font = OsuFont.Default.With(size: 10, weight: FontWeight.Bold),
@ -86,6 +89,18 @@ namespace osu.Game.Overlays.SkinEditor
this.FadeInFromZero(200, Easing.OutQuint); this.FadeInFromZero(200, Easing.OutQuint);
} }
protected override bool OnHover(HoverEvent e)
{
updateSelectedState();
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
updateSelectedState();
base.OnHoverLost(e);
}
protected override void OnSelected() protected override void OnSelected()
{ {
// base logic hides selected blueprints when not selected, but skin blueprints don't do that. // base logic hides selected blueprints when not selected, but skin blueprints don't do that.
@ -104,6 +119,7 @@ namespace osu.Game.Overlays.SkinEditor
outlineBox.Child.FadeTo(IsSelected ? 0.2f : 0, 200, Easing.OutQuint); outlineBox.Child.FadeTo(IsSelected ? 0.2f : 0, 200, Easing.OutQuint);
anchorOriginVisualiser.FadeTo(IsSelected ? 1 : 0, 200, Easing.OutQuint); anchorOriginVisualiser.FadeTo(IsSelected ? 1 : 0, 200, Easing.OutQuint);
label.FadeTo(IsSelected || IsHovered ? 1 : 0, 200, Easing.OutQuint);
} }
private Quad drawableQuad; private Quad drawableQuad;