From da096376af7b84ec7c6590e976a1505ab33a394a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 11 May 2024 09:31:32 +0300 Subject: [PATCH] Fix DI error in mod tooltip --- .../Screens/Select/FooterV2/FooterButtonModsV2.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/FooterV2/FooterButtonModsV2.cs b/osu.Game/Screens/Select/FooterV2/FooterButtonModsV2.cs index 2ceddedeb5..02eb2028c5 100644 --- a/osu.Game/Screens/Select/FooterV2/FooterButtonModsV2.cs +++ b/osu.Game/Screens/Select/FooterV2/FooterButtonModsV2.cs @@ -267,13 +267,16 @@ namespace osu.Game.Screens.Select.FooterV2 { public readonly Bindable> Mods = new Bindable>(); + [Resolved] + private OverlayColourProvider colourProvider { get; set; } = null!; + protected override void LoadComplete() { base.LoadComplete(); Mods.BindValueChanged(v => Text = FooterButtonModsV2Strings.Mods(v.NewValue.Count).ToUpper(), true); } - public ITooltip> GetCustomTooltip() => new ModTooltip(); + public ITooltip> GetCustomTooltip() => new ModTooltip(colourProvider); public IReadOnlyList? TooltipContent => Mods.Value; @@ -281,8 +284,16 @@ namespace osu.Game.Screens.Select.FooterV2 { private ModDisplay extendedModDisplay = null!; + [Cached] + private OverlayColourProvider colourProvider; + + public ModTooltip(OverlayColourProvider colourProvider) + { + this.colourProvider = colourProvider; + } + [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) + private void load() { AutoSizeAxes = Axes.Both; CornerRadius = CORNER_RADIUS;