1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 12:45:09 +08:00

slider border thickness

This commit is contained in:
Santeri Nogelainen 2019-03-14 21:57:39 +02:00
parent bbf42fdd00
commit 92595e43f6
4 changed files with 40 additions and 2 deletions

View File

@ -160,6 +160,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
base.SkinChanged(skin, allowFallback);
Body.BorderSize = skin.GetValue<SkinConfiguration, int?>(s => s.SliderBorderSize) ?? Body.BorderSize;
Body.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? Body.AccentColour;
Body.BorderColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Body.BorderColour;
Ball.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Ball.AccentColour;

View File

@ -64,6 +64,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
}
}
/// <summary>
/// Used to size the path border.
/// </summary>
public int BorderSize {
get => path.BorderSize;
set {
if (path.BorderSize == value)
return;
path.BorderSize = value;
container.ForceRedraw();
}
}
public Quad PathDrawQuad => container.ScreenSpaceDrawQuad;
protected SliderBody()
@ -130,12 +145,28 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
}
}
private int borderSize = 100;
public int BorderSize {
get => borderSize;
set {
if (borderSize == value)
return;
borderSize = value;
InvalidateTexture();
}
}
private float calucatedBorderPortion => BorderSize / 100f * border_portion;
protected override Color4 ColourAt(float position)
{
if (position <= border_portion)
if (position <= calucatedBorderPortion)
return BorderColour;
position -= border_portion;
position -= calucatedBorderPortion;
return new Color4(AccentColour.R, AccentColour.G, AccentColour.B, (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * position / gradient_portion) * AccentColour.A);
}
}

View File

@ -33,6 +33,10 @@ namespace osu.Game.Skinning
case @"CursorExpand":
skin.CursorExpand = pair.Value != "0";
break;
case @"SliderBorderSize":
if (int.TryParse(pair.Value, out int size))
skin.SliderBorderSize = size;
break;
}
break;

View File

@ -25,6 +25,8 @@ namespace osu.Game.Skinning
public int HitCircleOverlap { get; set; }
public int? SliderBorderSize { get; set; }
public bool? CursorExpand { get; set; } = true;
}
}