1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:07:52 +08:00

Fix incorrect application layer causing completely discoloured circles

This commit is contained in:
Dean Herbert 2023-01-11 18:25:24 +09:00
parent 0d1046ed83
commit e9571be4ab
2 changed files with 24 additions and 15 deletions

View File

@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
private readonly bool hasNumber; private readonly bool hasNumber;
protected Drawable CircleSprite = null!; protected LegacyKiaiFlashingDrawable CircleSprite = null!;
protected Drawable OverlaySprite = null!; protected LegacyKiaiFlashingDrawable OverlaySprite = null!;
protected Container OverlayLayer { get; private set; } = null!; protected Container OverlayLayer { get; private set; } = null!;
@ -66,29 +66,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
// at this point, any further texture fetches should be correctly using the priority source if the base texture was retrieved using it. // at this point, any further texture fetches should be correctly using the priority source if the base texture was retrieved using it.
// the conditional above handles the case where a sliderendcircle.png is retrieved from the skin, but sliderendcircleoverlay.png doesn't exist. // the conditional above handles the case where a sliderendcircle.png is retrieved from the skin, but sliderendcircleoverlay.png doesn't exist.
// expected behaviour in this scenario is not showing the overlay, rather than using hitcircleoverlay.png. // expected behaviour in this scenario is not showing the overlay, rather than using hitcircleoverlay.png.
Color4 objectColour = drawableOsuObject!.AccentColour.Value;
int add = Math.Max(25, 300 - (int)(objectColour.R * 255) - (int)(objectColour.G * 255) - (int)(objectColour.B * 255));
Color4 finalColour = new Color4(
(byte)Math.Min((byte)(objectColour.R * 255) + add, 255),
(byte)Math.Min((byte)(objectColour.G * 255) + add, 255),
(byte)Math.Min((byte)(objectColour.B * 255) + add, 255),
255);
InternalChildren = new[] InternalChildren = new[]
{ {
CircleSprite = new LegacyKiaiFlashingDrawable(() => new Sprite { Texture = skin.GetTexture(circleName) }) CircleSprite = new LegacyKiaiFlashingDrawable(() => new Sprite { Texture = skin.GetTexture(circleName) })
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Colour = finalColour,
}, },
OverlayLayer = new Container OverlayLayer = new Container
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Colour = finalColour,
Child = OverlaySprite = new LegacyKiaiFlashingDrawable(() => skin.GetAnimation(@$"{circleName}overlay", true, true, frameLength: 1000 / 2d)) Child = OverlaySprite = new LegacyKiaiFlashingDrawable(() => skin.GetAnimation(@$"{circleName}overlay", true, true, frameLength: 1000 / 2d))
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -126,7 +114,21 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{ {
base.LoadComplete(); base.LoadComplete();
accentColour.BindValueChanged(colour => CircleSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true); accentColour.BindValueChanged(colour =>
{
Color4 objectColour = colour.NewValue;
int add = Math.Max(25, 300 - (int)(objectColour.R * 255) - (int)(objectColour.G * 255) - (int)(objectColour.B * 255));
var kiaiTintColour = new Color4(
(byte)Math.Min((byte)(objectColour.R * 255) + add, 255),
(byte)Math.Min((byte)(objectColour.G * 255) + add, 255),
(byte)Math.Min((byte)(objectColour.B * 255) + add, 255),
255);
CircleSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue);
OverlaySprite.KiaiGlowColour = CircleSprite.KiaiGlowColour = LegacyColourCompatibility.DisallowZeroAlpha(kiaiTintColour);
}, true);
if (hasNumber) if (hasNumber)
indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true); indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true);

View File

@ -6,11 +6,18 @@ using osu.Framework.Audio.Track;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osuTK.Graphics;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
public partial class LegacyKiaiFlashingDrawable : BeatSyncedContainer public partial class LegacyKiaiFlashingDrawable : BeatSyncedContainer
{ {
public Color4 KiaiGlowColour
{
get => flashingDrawable.Colour;
set => flashingDrawable.Colour = value;
}
private readonly Drawable flashingDrawable; private readonly Drawable flashingDrawable;
private const float flash_opacity = 0.3f; private const float flash_opacity = 0.3f;