mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 14:12:54 +08:00
Merge pull request #12071 from peppy/visually-distinguish-slider-node-types
Give each type of slider path type a unique colour to help visually distinguish them
This commit is contained in:
commit
413754ede3
@ -7,11 +7,13 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -23,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A visualisation of a single <see cref="PathControlPoint"/> in a <see cref="Slider"/>.
|
/// A visualisation of a single <see cref="PathControlPoint"/> in a <see cref="Slider"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PathControlPointPiece : BlueprintPiece<Slider>
|
public class PathControlPointPiece : BlueprintPiece<Slider>, IHasTooltip
|
||||||
{
|
{
|
||||||
public Action<PathControlPointPiece, MouseButtonEvent> RequestSelection;
|
public Action<PathControlPointPiece, MouseButtonEvent> RequestSelection;
|
||||||
|
|
||||||
@ -195,7 +197,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
|
|
||||||
markerRing.Alpha = IsSelected.Value ? 1 : 0;
|
markerRing.Alpha = IsSelected.Value ? 1 : 0;
|
||||||
|
|
||||||
Color4 colour = ControlPoint.Type.Value != null ? colours.Red : colours.Yellow;
|
Color4 colour = getColourFromNodeType();
|
||||||
|
|
||||||
if (IsHovered || IsSelected.Value)
|
if (IsHovered || IsSelected.Value)
|
||||||
colour = colour.Lighten(1);
|
colour = colour.Lighten(1);
|
||||||
@ -203,5 +205,28 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
marker.Colour = colour;
|
marker.Colour = colour;
|
||||||
marker.Scale = new Vector2(slider.Scale);
|
marker.Scale = new Vector2(slider.Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Color4 getColourFromNodeType()
|
||||||
|
{
|
||||||
|
if (!(ControlPoint.Type.Value is PathType pathType))
|
||||||
|
return colours.Yellow;
|
||||||
|
|
||||||
|
switch (pathType)
|
||||||
|
{
|
||||||
|
case PathType.Catmull:
|
||||||
|
return colours.Seafoam;
|
||||||
|
|
||||||
|
case PathType.Bezier:
|
||||||
|
return colours.Pink;
|
||||||
|
|
||||||
|
case PathType.PerfectCurve:
|
||||||
|
return colours.PurpleDark;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return colours.Red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TooltipText => ControlPoint.Type.Value.ToString() ?? string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user