diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index 70a107ca04..fd6ef25648 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -38,6 +38,9 @@ protected Color4 HoverColour } } + [Resolved] + private OsuColour colours { get; set; } + protected override Container Content => content; private readonly Container content; @@ -73,17 +76,25 @@ public OsuAnimatedButton() } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { if (AutoSizeAxes != Axes.None) { content.RelativeSizeAxes = (Axes.Both & ~AutoSizeAxes); content.AutoSizeAxes = AutoSizeAxes; } - - Enabled.BindValueChanged(enabled => this.FadeColour(enabled.NewValue ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); } + protected override void LoadComplete() + { + base.LoadComplete(); + + Colour = enablementColour; + Enabled.BindValueChanged(_ => this.FadeColour(enablementColour, 200, Easing.OutQuint)); + } + + private Color4 enablementColour => Enabled.Value ? Color4.White : colours.Gray9; + protected override bool OnHover(HoverEvent e) { hover.FadeIn(500, Easing.OutQuint);