mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 13:42:59 +08:00
Merge branch 'skin-metric-parity' into legacy-cursor-middle
This commit is contained in:
commit
af81592428
@ -48,10 +48,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
Body = new SnakingSliderBody(s)
|
Body = new SnakingSliderBody(s),
|
||||||
{
|
|
||||||
PathRadius = s.Scale * OsuHitObject.OBJECT_RADIUS,
|
|
||||||
},
|
|
||||||
ticks = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
|
ticks = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
|
||||||
repeatPoints = new Container<DrawableRepeatPoint> { RelativeSizeAxes = Axes.Both },
|
repeatPoints = new Container<DrawableRepeatPoint> { RelativeSizeAxes = Axes.Both },
|
||||||
Ball = new SliderBall(s, this)
|
Ball = new SliderBall(s, this)
|
||||||
@ -105,7 +102,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
||||||
scaleBindable.BindValueChanged(scale =>
|
scaleBindable.BindValueChanged(scale =>
|
||||||
{
|
{
|
||||||
Body.PathRadius = scale.NewValue * 64;
|
updatePathRadius();
|
||||||
Ball.Scale = new Vector2(scale.NewValue);
|
Ball.Scale = new Vector2(scale.NewValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -157,16 +154,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Body.RecyclePath();
|
Body.RecyclePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float sliderPathRadius;
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
{
|
{
|
||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin, allowFallback);
|
||||||
|
|
||||||
Body.BorderSize = skin.GetValue<SkinConfiguration, float?>(s => s.SliderBorderSize) ?? SliderBody.DEFAULT_BORDER_SIZE;
|
Body.BorderSize = skin.GetValue<SkinConfiguration, float?>(s => s.SliderBorderSize) ?? SliderBody.DEFAULT_BORDER_SIZE;
|
||||||
|
sliderPathRadius = skin.GetValue<SkinConfiguration, float?>(s => s.SliderPathRadius) ?? OsuHitObject.OBJECT_RADIUS;
|
||||||
|
updatePathRadius();
|
||||||
|
|
||||||
Body.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? AccentColour.Value;
|
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;
|
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;
|
Ball.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? AccentColour.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updatePathRadius() => Body.PathRadius = slider.Scale * sliderPathRadius;
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
{
|
{
|
||||||
if (userTriggered || Time.Current < slider.EndTime)
|
if (userTriggered || Time.Current < slider.EndTime)
|
||||||
|
@ -101,11 +101,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
}, confineMode: ConfineMode.NoScaling)
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
Size = new Vector2(0.75f);
|
Size = new Vector2(0.8f);
|
||||||
|
|
||||||
InternalChild = new Container
|
InternalChild = new Container
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,13 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
protected IResourceStore<SampleChannel> Samples;
|
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)
|
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
|
||||||
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
|
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
|
||||||
{
|
{
|
||||||
@ -41,6 +48,16 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
Samples = audioManager.GetSampleStore(storage);
|
Samples = audioManager.GetSampleStore(storage);
|
||||||
Textures = new TextureStore(new TextureLoaderStore(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)
|
protected override void Dispose(bool isDisposing)
|
||||||
@ -95,7 +112,6 @@ namespace osu.Game.Skinning
|
|||||||
public override Texture GetTexture(string componentName)
|
public override Texture GetTexture(string componentName)
|
||||||
{
|
{
|
||||||
float ratio = 2;
|
float ratio = 2;
|
||||||
|
|
||||||
var texture = Textures.Get($"{componentName}@2x");
|
var texture = Textures.Get($"{componentName}@2x");
|
||||||
|
|
||||||
if (texture == null)
|
if (texture == null)
|
||||||
@ -105,7 +121,19 @@ namespace osu.Game.Skinning
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (texture != null)
|
if (texture != null)
|
||||||
texture.ScaleAdjust = ratio / 0.72f; // brings sizing roughly in-line with stable
|
{
|
||||||
|
texture.ScaleAdjust = ratio;
|
||||||
|
|
||||||
|
switch (componentName)
|
||||||
|
{
|
||||||
|
case "cursormiddle":
|
||||||
|
case "cursortrail":
|
||||||
|
case "cursor":
|
||||||
|
// apply inverse of adjustment in OsuPlayfieldAdjustmentContainer for non-gameplay-scale textures.
|
||||||
|
texture.ScaleAdjust *= 1.6f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public float? SliderBorderSize { get; set; }
|
public float? SliderBorderSize { get; set; }
|
||||||
|
|
||||||
|
public float? SliderPathRadius { get; set; }
|
||||||
|
|
||||||
public bool? CursorExpand { get; set; } = true;
|
public bool? CursorExpand { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user