mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 10:23:03 +08:00
slider border thickness
This commit is contained in:
parent
bbf42fdd00
commit
92595e43f6
@ -160,6 +160,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
base.SkinChanged(skin, allowFallback);
|
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.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;
|
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;
|
Ball.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Ball.AccentColour;
|
||||||
|
@ -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;
|
public Quad PathDrawQuad => container.ScreenSpaceDrawQuad;
|
||||||
|
|
||||||
protected SliderBody()
|
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)
|
protected override Color4 ColourAt(float position)
|
||||||
{
|
{
|
||||||
if (position <= border_portion)
|
if (position <= calucatedBorderPortion)
|
||||||
return BorderColour;
|
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);
|
return new Color4(AccentColour.R, AccentColour.G, AccentColour.B, (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * position / gradient_portion) * AccentColour.A);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,10 @@ namespace osu.Game.Skinning
|
|||||||
case @"CursorExpand":
|
case @"CursorExpand":
|
||||||
skin.CursorExpand = pair.Value != "0";
|
skin.CursorExpand = pair.Value != "0";
|
||||||
break;
|
break;
|
||||||
|
case @"SliderBorderSize":
|
||||||
|
if (int.TryParse(pair.Value, out int size))
|
||||||
|
skin.SliderBorderSize = size;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public int HitCircleOverlap { get; set; }
|
public int HitCircleOverlap { get; set; }
|
||||||
|
|
||||||
|
public int? SliderBorderSize { get; set; }
|
||||||
|
|
||||||
public bool? CursorExpand { get; set; } = true;
|
public bool? CursorExpand { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user