1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

Move alpha adjustment back to LegacySliderBody to correctly handle default legacy skin

This commit is contained in:
Dean Herbert 2021-09-01 15:10:56 +09:00
parent 7a447f5128
commit 4f9c3fde07
3 changed files with 12 additions and 22 deletions

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
pathVersion.BindValueChanged(_ => Refresh());
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.SnakingOutSliders, configSnakingOut);
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
}
}
private void updateAccentColour(ISkinSource skin, Color4 defaultAccentColour)
=> AccentColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderTrackOverride)?.Value ?? defaultAccentColour;
protected virtual Color4 GetBodyAccentColour(ISkinSource skin, Color4 hitObjectAccentColour) =>
skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderTrackOverride)?.Value ?? hitObjectAccentColour;
}
}

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Skinning.Default;
using osu.Game.Skinning;
using osu.Game.Utils;
using osuTK.Graphics;
@ -14,6 +15,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{
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 const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS);

View File

@ -3,11 +3,9 @@
using System;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{
@ -120,23 +118,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{
switch (lookup)
{
case OsuSkinColour colourLookup:
var colour = base.GetConfig<SkinCustomColourLookup, TValue>(new SkinCustomColourLookup(colourLookup));
if (colour == null)
return null;
switch (colourLookup)
{
case OsuSkinColour.SliderTrackOverride:
var bindableColour = ((Bindable<Color4>)colour);
// legacy skins use a constant value for slider track alpha, regardless of the source colour.
bindableColour.Value = bindableColour.Value.Opacity(0.7f);
break;
}
return colour;
case OsuSkinColour colour:
return base.GetConfig<SkinCustomColourLookup, TValue>(new SkinCustomColourLookup(colour));
case OsuSkinConfiguration osuLookup:
switch (osuLookup)