From 8b49572c44f654f7cd59036c204b3975fc2e91c7 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 5 Jan 2026 17:44:41 +0900 Subject: [PATCH] Fix title overlap Uses the same method of displaying the mod selection as the old song select (as an overlay of the entire game). --- .../Playlists/PlaylistsSongSelectV2.cs | 40 ++++++++++++------- osu.Game/Screens/SelectV2/SongSelect.cs | 18 ++++++++- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelectV2.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelectV2.cs index 586898f414..20c08ce2d1 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelectV2.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelectV2.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using Humanizer; @@ -31,12 +32,17 @@ namespace osu.Game.Screens.OnlinePlay.Playlists protected readonly Bindable Freestyle = new Bindable(true); private readonly Bindable> freeMods = new Bindable>([]); + [Resolved] + private IOverlayManager? overlayManager { get; set; } + private readonly AddToPlaylistFooterButton addToPlaylistFooterButton; private readonly Room room; private ModSelectOverlay modSelect = null!; private FreeModSelectOverlay freeModSelect = null!; + private IDisposable? modSelectOverlayRegistration; + public PlaylistsSongSelectV2(Room room) { this.room = room; @@ -61,30 +67,30 @@ namespace osu.Game.Screens.OnlinePlay.Playlists [BackgroundDependencyLoader] private void load() { - AddRangeInternal(new Drawable[] + AddInternal(new PlaylistTray(room) { - freeModSelect = new FreeModSelectOverlay + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Margin = new MarginPadding { - SelectedMods = { BindTarget = freeMods }, - IsValidMod = isValidAllowedMod, - }, - new PlaylistTray(room) - { - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Margin = new MarginPadding - { - Bottom = ScreenFooterButton.HEIGHT, - Right = OsuGame.SCREEN_EDGE_MARGIN - } + Bottom = ScreenFooterButton.HEIGHT, + Right = OsuGame.SCREEN_EDGE_MARGIN } }); + + LoadComponent(freeModSelect = new FreeModSelectOverlay + { + SelectedMods = { BindTarget = freeMods }, + IsValidMod = isValidAllowedMod, + }); } protected override void LoadComplete() { base.LoadComplete(); + modSelectOverlayRegistration = overlayManager?.RegisterBlockingOverlay(freeModSelect); + Mods.BindValueChanged(onGlobalModsChanged); Ruleset.BindValueChanged(onRulesetChanged); Freestyle.BindValueChanged(onFreestyleChanged); @@ -250,5 +256,11 @@ namespace osu.Game.Screens.OnlinePlay.Playlists && Mods.Value.All(m => m.Acronym != mod.Acronym) // Mod must be compatible with all the required mods. && ModUtils.CheckCompatibleSet(Mods.Value.Append(mod).ToArray()); + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + modSelectOverlayRegistration?.Dispose(); + } } } diff --git a/osu.Game/Screens/SelectV2/SongSelect.cs b/osu.Game/Screens/SelectV2/SongSelect.cs index 49d9bab9c2..c467ee6d50 100644 --- a/osu.Game/Screens/SelectV2/SongSelect.cs +++ b/osu.Game/Screens/SelectV2/SongSelect.cs @@ -146,6 +146,9 @@ namespace osu.Game.Screens.SelectV2 [Resolved] private IDialogOverlay? dialogOverlay { get; set; } + [Resolved] + private IOverlayManager? overlayManager { get; set; } + private InputManager inputManager = null!; private readonly RealmPopulatingOnlineLookupSource onlineLookupSource = new RealmPopulatingOnlineLookupSource(); @@ -153,6 +156,8 @@ namespace osu.Game.Screens.SelectV2 private Bindable configBackgroundBlur = null!; private Bindable showConvertedBeatmaps = null!; + private IDisposable? modSelectOverlayRegistration; + [BackgroundDependencyLoader] private void load(AudioManager audio, OsuConfigManager config) { @@ -288,10 +293,11 @@ namespace osu.Game.Screens.SelectV2 Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, }, - modSpeedHotkeyHandler = new ModSpeedHotkeyHandler(), - modSelectOverlay = CreateModSelectOverlay(), + modSpeedHotkeyHandler = new ModSpeedHotkeyHandler() }); + LoadComponent(modSelectOverlay = CreateModSelectOverlay()); + configBackgroundBlur = config.GetBindable(OsuSetting.SongSelectBackgroundBlur); configBackgroundBlur.BindValueChanged(e => { @@ -361,6 +367,8 @@ namespace osu.Game.Screens.SelectV2 { base.LoadComplete(); + modSelectOverlayRegistration = overlayManager?.RegisterBlockingOverlay(modSelectOverlay); + inputManager = GetContainingInputManager()!; filterControl.CriteriaChanged += criteriaChanged; @@ -1210,5 +1218,11 @@ namespace osu.Game.Screens.SelectV2 public Bindable ScopedBeatmapSet => filterControl.ScopedBeatmapSet; #endregion + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + modSelectOverlayRegistration?.Dispose(); + } } }