1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 03:02:54 +08:00

Move default background colour specification to OsuButton

This commit is contained in:
Salman Ahmed 2022-05-09 18:21:00 +03:00
parent ceb6276d2f
commit 172524ff8a
2 changed files with 5 additions and 14 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Diagnostics; using System.Diagnostics;
using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -12,6 +13,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
@ -86,11 +88,11 @@ namespace osu.Game.Graphics.UserInterface
AddInternal(new HoverClickSounds(hoverSounds.Value)); AddInternal(new HoverClickSounds(hoverSounds.Value));
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours) private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours)
{ {
if (backgroundColour == null) if (backgroundColour == null)
BackgroundColour = colours.BlueDark; BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3;
} }
protected override void LoadComplete() protected override void LoadComplete()

View File

@ -2,13 +2,9 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic; using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterfaceV2 namespace osu.Game.Graphics.UserInterfaceV2
{ {
@ -26,13 +22,6 @@ namespace osu.Game.Graphics.UserInterfaceV2
} }
} }
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours)
{
if (BackgroundColour == Color4.White)
BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3;
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();