Do not rely on `OverlayColourProvider` presence

This commit is contained in:
Bartłomiej Dach 2023-07-13 21:45:06 +02:00
parent 94201579f6
commit eeb50e2700
No known key found for this signature in database
1 changed files with 9 additions and 5 deletions

View File

@ -11,6 +11,7 @@
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
@ -33,7 +34,10 @@ public partial class RevertToDefaultButton<T> : OsuClickableContainer, IHasCurre
private Circle circle = null!;
[Resolved]
private OverlayColourProvider colours { get; set; } = null!;
private OsuColour colours { get; set; } = null!;
[Resolved]
private OverlayColourProvider? colourProvider { get; set; }
public Bindable<T> Current
{
@ -124,16 +128,16 @@ private void updateState()
{
icon.RotateTo(-40, 500, Easing.OutQuint);
icon.FadeColour(colours.Light1, 300, Easing.OutQuint);
circle.FadeColour(colours.Background2, 300, Easing.OutQuint);
icon.FadeColour(colourProvider?.Light1 ?? colours.YellowLight, 300, Easing.OutQuint);
circle.FadeColour(colourProvider?.Background2 ?? colours.Gray6, 300, Easing.OutQuint);
this.ScaleTo(1.2f, 300, Easing.OutQuint);
}
else
{
icon.RotateTo(0, 100, Easing.OutQuint);
icon.FadeColour(colours.Colour0, 100, Easing.OutQuint);
circle.FadeColour(colours.Background3, 100, Easing.OutQuint);
icon.FadeColour(colourProvider?.Colour0 ?? colours.Yellow, 100, Easing.OutQuint);
circle.FadeColour(colourProvider?.Background3 ?? colours.Gray3, 100, Easing.OutQuint);
this.ScaleTo(1f, 100, Easing.OutQuint);
}
}