From ace25af949ab39946e4a8b57103b40247c96dbfa Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 9 May 2022 20:55:26 +0300 Subject: [PATCH] Revert "Move default background colour specification to `OsuButton`" This reverts commit 172524ff8a3812ffce89361c5552a6426529df33. --- osu.Game/Graphics/UserInterface/OsuButton.cs | 8 +++----- osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs | 11 +++++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 6fa63e587417..29a797bd78e1 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -13,7 +12,6 @@ using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays; using osuTK.Graphics; namespace osu.Game.Graphics.UserInterface @@ -88,11 +86,11 @@ public OsuButton(HoverSampleSet? hoverSounds = HoverSampleSet.Button) AddInternal(new HoverClickSounds(hoverSounds.Value)); } - [BackgroundDependencyLoader(permitNulls: true)] - private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) + [BackgroundDependencyLoader] + private void load(OsuColour colours) { if (backgroundColour == null) - BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; + BackgroundColour = colours.BlueDark; } protected override void LoadComplete() diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index b1529774d9e3..f535a32b3999 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -2,9 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using JetBrains.Annotations; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; +using osuTK.Graphics; namespace osu.Game.Graphics.UserInterfaceV2 { @@ -22,6 +26,13 @@ public override float Height } } + [BackgroundDependencyLoader(true)] + private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) + { + if (BackgroundColour == Color4.White) + BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; + } + protected override void LoadComplete() { base.LoadComplete();