1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

Merge pull request #14589 from peppy/fix-traceable-sliders

Fix traceable sliders incorrectly being opaque
This commit is contained in:
Dan Balasescu 2021-09-02 11:31:53 +09:00 committed by GitHub
commit 70114584fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
pathVersion.BindValueChanged(_ => Refresh()); pathVersion.BindValueChanged(_ => Refresh());
accentColour = drawableObject.AccentColour.GetBoundCopy(); accentColour = drawableObject.AccentColour.GetBoundCopy();
accentColour.BindValueChanged(accent => updateAccentColour(skin, accent.NewValue), true); accentColour.BindValueChanged(accent => AccentColour = GetBodyAccentColour(skin, accent.NewValue), true);
config?.BindWith(OsuRulesetSetting.SnakingInSliders, SnakingIn); config?.BindWith(OsuRulesetSetting.SnakingInSliders, SnakingIn);
config?.BindWith(OsuRulesetSetting.SnakingOutSliders, configSnakingOut); config?.BindWith(OsuRulesetSetting.SnakingOutSliders, configSnakingOut);
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
} }
} }
private void updateAccentColour(ISkinSource skin, Color4 defaultAccentColour) protected virtual Color4 GetBodyAccentColour(ISkinSource skin, Color4 hitObjectAccentColour) =>
=> AccentColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderTrackOverride)?.Value ?? defaultAccentColour; skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderTrackOverride)?.Value ?? hitObjectAccentColour;
} }
} }

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
/// <summary> /// <summary>
/// A <see cref="SliderBody"/> which changes its curve depending on the snaking progress. /// A <see cref="SliderBody"/> which changes its curve depending on the snaking progress.
/// </summary> /// </summary>
public class SnakingSliderBody : SliderBody, ISliderProgress public abstract class SnakingSliderBody : SliderBody, ISliderProgress
{ {
public readonly List<Vector2> CurrentCurve = new List<Vector2>(); public readonly List<Vector2> CurrentCurve = new List<Vector2>();

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Skinning.Default; using osu.Game.Rulesets.Osu.Skinning.Default;
using osu.Game.Skinning;
using osu.Game.Utils; using osu.Game.Utils;
using osuTK.Graphics; using osuTK.Graphics;
@ -14,6 +15,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{ {
protected override DrawableSliderPath CreateSliderPath() => new LegacyDrawableSliderPath(); protected override DrawableSliderPath CreateSliderPath() => new LegacyDrawableSliderPath();
protected override Color4 GetBodyAccentColour(ISkinSource skin, Color4 hitObjectAccentColour)
{
// legacy skins use a constant value for slider track alpha, regardless of the source colour.
return base.GetBodyAccentColour(skin, hitObjectAccentColour).Opacity(0.7f);
}
private class LegacyDrawableSliderPath : DrawableSliderPath private class LegacyDrawableSliderPath : DrawableSliderPath
{ {
private const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS); private const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS);
@ -22,8 +29,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
// Roughly matches osu!stable's slider border portions. // Roughly matches osu!stable's slider border portions.
=> base.CalculatedBorderPortion * 0.77f; => base.CalculatedBorderPortion * 0.77f;
public new Color4 AccentColour => new Color4(base.AccentColour.R, base.AccentColour.G, base.AccentColour.B, 0.7f);
protected override Color4 ColourAt(float position) protected override Color4 ColourAt(float position)
{ {
float realBorderPortion = shadow_portion + CalculatedBorderPortion; float realBorderPortion = shadow_portion + CalculatedBorderPortion;