Align slider path size with legacy skins

This commit is contained in:
Dean Herbert 2019-07-24 18:49:52 +09:00
parent 9473f6d3e3
commit 46e17646ac
3 changed files with 22 additions and 4 deletions

View File

@ -48,10 +48,7 @@ public DrawableSlider(Slider s)
InternalChildren = new Drawable[]
{
Body = new SnakingSliderBody(s)
{
PathRadius = s.Scale * OsuHitObject.OBJECT_RADIUS,
},
Body = new SnakingSliderBody(s),
ticks = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
repeatPoints = new Container<DrawableRepeatPoint> { RelativeSizeAxes = Axes.Both },
Ball = new SliderBall(s, this)
@ -162,6 +159,8 @@ protected override void SkinChanged(ISkinSource skin, bool allowFallback)
base.SkinChanged(skin, allowFallback);
Body.BorderSize = skin.GetValue<SkinConfiguration, float?>(s => s.SliderBorderSize) ?? SliderBody.DEFAULT_BORDER_SIZE;
Body.PathRadius = slider.Scale * (skin.GetValue<SkinConfiguration, float?>(s => s.SliderPathRadius) ?? OsuHitObject.OBJECT_RADIUS);
Body.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? AccentColour.Value;
Body.BorderColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Color4.White;
Ball.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? AccentColour.Value;

View File

@ -24,6 +24,13 @@ public class LegacySkin : Skin
protected IResourceStore<SampleChannel> Samples;
/// <summary>
/// On osu-stable, hitcircles have 5 pixels of transparent padding on each side to allow for shadows etc.
/// Their hittable area is 128px, but the actual circle portion is 118px.
/// We must account for some gameplay elements such as slider bodies, where this padding is not present.
/// </summary>
private const float legacy_circle_radius = 64 - 5;
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
{
@ -41,6 +48,16 @@ protected LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager
Samples = audioManager.GetSampleStore(storage);
Textures = new TextureStore(new TextureLoaderStore(storage));
bool hasHitCircle = false;
using (var testStream = storage.GetStream("hitcircle"))
hasHitCircle |= testStream != null;
if (hasHitCircle)
{
Configuration.SliderPathRadius = legacy_circle_radius;
}
}
protected override void Dispose(bool isDisposing)

View File

@ -27,6 +27,8 @@ public class SkinConfiguration : IHasComboColours, IHasCustomColours
public float? SliderBorderSize { get; set; }
public float? SliderPathRadius { get; set; }
public bool? CursorExpand { get; set; } = true;
}
}