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()); 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

@ -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);

View File

@ -3,11 +3,9 @@
using System; using System;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Skinning.Legacy namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{ {
@ -120,23 +118,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{ {
switch (lookup) switch (lookup)
{ {
case OsuSkinColour colourLookup: case OsuSkinColour colour:
var colour = base.GetConfig<SkinCustomColourLookup, TValue>(new SkinCustomColourLookup(colourLookup)); return base.GetConfig<SkinCustomColourLookup, TValue>(new SkinCustomColourLookup(colour));
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 OsuSkinConfiguration osuLookup: case OsuSkinConfiguration osuLookup:
switch (osuLookup) switch (osuLookup)