Skip to content

Commit

Permalink
Revert "Move default background colour specification to OsuButton"
Browse files Browse the repository at this point in the history
This reverts commit 172524f.
  • Loading branch information
frenzibyte committed May 9, 2022
1 parent 172524f commit ace25af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 3 additions & 5 deletions osu.Game/Graphics/UserInterface/OsuButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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()
Expand Down
11 changes: 11 additions & 0 deletions osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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();
Expand Down

0 comments on commit ace25af

Please sign in to comment.