From 1dd026c0f096e7e34a10110fbdb55f3eeb46ac07 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Nov 2025 13:55:01 +0900 Subject: [PATCH] Fix everything crashing --- .../Matchmaking/MatchmakingTestScene.cs | 10 +++--- .../Matchmaking/Intro/ScreenIntro.cs | 27 ++------------- .../Match/MatchmakingBackgroundScreen.cs | 33 ++++++++----------- .../Matchmaking/Match/ScreenMatchmaking.cs | 5 ++- 4 files changed, 26 insertions(+), 49 deletions(-) diff --git a/osu.Game.Tests/Visual/Matchmaking/MatchmakingTestScene.cs b/osu.Game.Tests/Visual/Matchmaking/MatchmakingTestScene.cs index 8c01083b12..ebfe795028 100644 --- a/osu.Game.Tests/Visual/Matchmaking/MatchmakingTestScene.cs +++ b/osu.Game.Tests/Visual/Matchmaking/MatchmakingTestScene.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Overlays; +using osu.Game.Screens; using osu.Game.Screens.OnlinePlay.Matchmaking.Match; using osu.Game.Tests.Visual.Multiplayer; @@ -19,14 +20,15 @@ namespace osu.Game.Tests.Visual.Matchmaking protected MatchmakingTestScene() { + BackgroundScreenStack backgroundStack; + base.Content.AddRange(new Drawable[] { - new MatchmakingBackgroundScreen.Content - { - RelativeSizeAxes = Axes.Both, - }, + backgroundStack = new BackgroundScreenStack(), Content = new Container { RelativeSizeAxes = Axes.Both } }); + + backgroundStack.Push(new MatchmakingBackgroundScreen(colourProvider)); } } } diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Intro/ScreenIntro.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Intro/ScreenIntro.cs index 093d9f6117..7d630ff986 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Intro/ScreenIntro.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Intro/ScreenIntro.cs @@ -5,7 +5,6 @@ using System; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -13,7 +12,7 @@ using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; -using osu.Game.Screens.OnlinePlay.Match; +using osu.Game.Screens.OnlinePlay.Matchmaking.Match; using osu.Game.Screens.OnlinePlay.Matchmaking.Queue; namespace osu.Game.Screens.OnlinePlay.Matchmaking.Intro @@ -53,7 +52,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Intro private IDisposable? duckOperation; - protected override BackgroundScreen CreateBackground() => new MatchmakingIntroBackgroundScreen(colourProvider); + protected override BackgroundScreen CreateBackground() => new MatchmakingBackgroundScreen(colourProvider); public ScreenIntro() { @@ -240,27 +239,5 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Intro beatmapImpactChannel?.Stop(); duckOperation?.Dispose(); } - - private partial class MatchmakingIntroBackgroundScreen : RoomBackgroundScreen - { - private readonly OverlayColourProvider colourProvider; - - public MatchmakingIntroBackgroundScreen(OverlayColourProvider colourProvider) - : base(null) - { - this.colourProvider = colourProvider; - } - - [BackgroundDependencyLoader] - private void load() - { - AddInternal(new Box - { - Depth = float.MinValue, - RelativeSizeAxes = Axes.Both, - Colour = colourProvider.Background5.Opacity(0.6f), - }); - } - } } } diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/MatchmakingBackgroundScreen.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/MatchmakingBackgroundScreen.cs index 89a404faaa..bc832a9346 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/MatchmakingBackgroundScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/MatchmakingBackgroundScreen.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Overlays; @@ -12,29 +11,25 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match { public partial class MatchmakingBackgroundScreen : BackgroundScreen { - public MatchmakingBackgroundScreen() + private readonly OverlayColourProvider colourProvider; + + public MatchmakingBackgroundScreen(OverlayColourProvider colourProvider) { - InternalChild = new Content - { - RelativeSizeAxes = Axes.Both - }; + this.colourProvider = colourProvider; } - public partial class Content : CompositeDrawable + [BackgroundDependencyLoader] + private void load(TextureStore textures) { - [BackgroundDependencyLoader] - private void load(TextureStore textures, OverlayColourProvider colourProvider) + InternalChild = new Sprite { - InternalChild = new Sprite - { - RelativeSizeAxes = Axes.Both, - Texture = textures.Get("Backgrounds/bg1"), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - Colour = colourProvider.Dark2 - }; - } + RelativeSizeAxes = Axes.Both, + Texture = textures.Get("Backgrounds/bg1"), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + Colour = colourProvider.Dark2 + }; } } } diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/ScreenMatchmaking.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/ScreenMatchmaking.cs index 8a48a089b4..a809270574 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/ScreenMatchmaking.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/ScreenMatchmaking.cs @@ -57,7 +57,10 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match public override bool ShowFooter => true; - protected override BackgroundScreen CreateBackground() => new MatchmakingBackgroundScreen(); + [Resolved] + private OverlayColourProvider colourProvider { get; set; } = null!; + + protected override BackgroundScreen CreateBackground() => new MatchmakingBackgroundScreen(colourProvider); [Cached(typeof(OnlinePlayBeatmapAvailabilityTracker))] private readonly OnlinePlayBeatmapAvailabilityTracker beatmapAvailabilityTracker = new MultiplayerBeatmapAvailabilityTracker();