From 16276dfcd6ce5c35d50fa0c63877ff293c2bbdd0 Mon Sep 17 00:00:00 2001 From: Mafalda Fernandes Date: Mon, 1 Apr 2024 19:21:05 +0100 Subject: [PATCH 01/21] Fix #27105: Mod search box doesnt track external focus changes In the Mod selection area, the search bar's focus could be changed by pressing TAB. However, when clicking outside of the search bar, the focus would be killed but two TABs were required to get the focus back on the search bar. This happened because the action of clicking in an empty area would trigger the search bar to change its appearence, but not its internal state. In my solution, I made the OnClick function aware of the search bar's state, so it would not only change its appearance, but also its state. Now, after clicking in an empty area, there is only needed one TAB to select the search box again, as expected. --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 3325cfe407..5ca26c739e 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -420,7 +420,7 @@ namespace osu.Game.Overlays.Mods yield return new ColumnDimContainer(new ModPresetColumn { Margin = new MarginPadding { Right = 10 } - }); + }, this); } yield return createModColumnContent(ModType.DifficultyReduction); @@ -438,7 +438,7 @@ namespace osu.Game.Overlays.Mods column.Margin = new MarginPadding { Right = 10 }; }); - return new ColumnDimContainer(column); + return new ColumnDimContainer(column, this); } private void createLocalMods() @@ -899,13 +899,17 @@ namespace osu.Game.Overlays.Mods [Resolved] private OsuColour colours { get; set; } = null!; - public ColumnDimContainer(ModSelectColumn column) + private ModSelectOverlay modSelectOverlayInstance; + + public ColumnDimContainer(ModSelectColumn column, ModSelectOverlay modSelectOverlay) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; Child = Column = column; column.Active.BindTo(Active); + + this.modSelectOverlayInstance = modSelectOverlay; } [BackgroundDependencyLoader] @@ -953,7 +957,7 @@ namespace osu.Game.Overlays.Mods RequestScroll?.Invoke(this); // Killing focus is done here because it's the only feasible place on ModSelectOverlay you can click on without triggering any action. - Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null)); + modSelectOverlayInstance.setTextBoxFocus(false); return true; } From 14c26926f328c646ee3d7d4ec28f6199976238f8 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Tue, 9 Apr 2024 09:55:50 +0200 Subject: [PATCH 02/21] Upgrade to SDL3 --- osu.Desktop/OsuGameDesktop.cs | 11 ++++++----- osu.Desktop/Program.cs | 25 ++++++++++++++----------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 2b232db274..e8783c997a 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -22,7 +22,7 @@ using osu.Game.IPC; using osu.Game.Online.Multiplayer; using osu.Game.Performance; using osu.Game.Utils; -using SDL2; +using SDL; namespace osu.Desktop { @@ -161,7 +161,7 @@ namespace osu.Desktop host.Window.Title = Name; } - protected override BatteryInfo CreateBatteryInfo() => new SDL2BatteryInfo(); + protected override BatteryInfo CreateBatteryInfo() => new SDL3BatteryInfo(); protected override void Dispose(bool isDisposing) { @@ -170,13 +170,14 @@ namespace osu.Desktop archiveImportIPCChannel?.Dispose(); } - private class SDL2BatteryInfo : BatteryInfo + private unsafe class SDL3BatteryInfo : BatteryInfo { public override double? ChargeLevel { get { - SDL.SDL_GetPowerInfo(out _, out int percentage); + int percentage; + SDL3.SDL_GetPowerInfo(null, &percentage); if (percentage == -1) return null; @@ -185,7 +186,7 @@ namespace osu.Desktop } } - public override bool OnBattery => SDL.SDL_GetPowerInfo(out _, out _) == SDL.SDL_PowerState.SDL_POWERSTATE_ON_BATTERY; + public override bool OnBattery => SDL3.SDL_GetPowerInfo(null, null) == SDL_PowerState.SDL_POWERSTATE_ON_BATTERY; } } } diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 2d7ec5aa5f..29b05a402f 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -13,7 +13,7 @@ using osu.Framework.Platform; using osu.Game; using osu.Game.IPC; using osu.Game.Tournament; -using SDL2; +using SDL; using Squirrel; namespace osu.Desktop @@ -52,16 +52,19 @@ namespace osu.Desktop // See https://www.mongodb.com/docs/realm/sdk/dotnet/compatibility/ if (windowsVersion.Major < 6 || (windowsVersion.Major == 6 && windowsVersion.Minor <= 2)) { - // If users running in compatibility mode becomes more of a common thing, we may want to provide better guidance or even consider - // disabling it ourselves. - // We could also better detect compatibility mode if required: - // https://stackoverflow.com/questions/10744651/how-i-can-detect-if-my-application-is-running-under-compatibility-mode#comment58183249_10744730 - SDL.SDL_ShowSimpleMessageBox(SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, - "Your operating system is too old to run osu!", - "This version of osu! requires at least Windows 8.1 to run.\n" - + "Please upgrade your operating system or consider using an older version of osu!.\n\n" - + "If you are running a newer version of windows, please check you don't have \"Compatibility mode\" turned on for osu!", IntPtr.Zero); - return; + unsafe + { + // If users running in compatibility mode becomes more of a common thing, we may want to provide better guidance or even consider + // disabling it ourselves. + // We could also better detect compatibility mode if required: + // https://stackoverflow.com/questions/10744651/how-i-can-detect-if-my-application-is-running-under-compatibility-mode#comment58183249_10744730 + SDL3.SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, + "Your operating system is too old to run osu!"u8, + "This version of osu! requires at least Windows 8.1 to run.\n"u8 + + "Please upgrade your operating system or consider using an older version of osu!.\n\n"u8 + + "If you are running a newer version of windows, please check you don't have \"Compatibility mode\" turned on for osu!"u8, null); + return; + } } setupSquirrel(); From 03e13ddc3095e8713a90dab9bb5f672b0ae75d4d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 17 Apr 2024 17:10:19 +0900 Subject: [PATCH 03/21] Globally silence Discord RPC registration failures --- osu.Desktop/DiscordRichPresence.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index f1c796d0cd..74ebd38f2c 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -6,7 +6,6 @@ using System.Text; using DiscordRPC; using DiscordRPC.Message; using Newtonsoft.Json; -using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.ObjectExtensions; @@ -80,14 +79,20 @@ namespace osu.Desktop client.OnReady += onReady; client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Message} ({e.Code})", LoggingTarget.Network, LogLevel.Error); - // A URI scheme is required to support game invitations, as well as informing Discord of the game executable path to support launching the game when a user clicks on join/spectate. - // The library doesn't properly support URI registration when ran from an app bundle on macOS. - if (!RuntimeInfo.IsApple) + try { client.RegisterUriScheme(); client.Subscribe(EventType.Join); client.OnJoin += onJoin; } + catch (Exception ex) + { + // This is known to fail in at least the following sandboxed environments: + // - macOS (when packaged as an app bundle) + // - flatpak (see: https://github.com/flathub/sh.ppy.osu/issues/170) + // There is currently no better way to do this offered by Discord, so the best we can do is simply ignore it for now. + Logger.Log($"Failed to register Discord URI scheme: {ex}"); + } client.Initialize(); } From 2a3ae6bce178124e65ca14d8ea62e82a6aa05ded Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 17 Apr 2024 02:34:41 +0300 Subject: [PATCH 04/21] Update all `TabItem` implementations to play select sample on `OnActivatedByUser` --- .../Graphics/UserInterface/OsuTabControl.cs | 24 ++++++++++++------- .../Graphics/UserInterface/PageTabControl.cs | 14 ++++++++++- .../BeatmapListingCardSizeTabControl.cs | 12 ++++++++-- .../Overlays/BeatmapListing/FilterTabItem.cs | 12 ++++++++-- .../OverlayPanelDisplayStyleControl.cs | 14 ++++++++++- osu.Game/Overlays/OverlayRulesetTabItem.cs | 14 ++++++++++- osu.Game/Overlays/OverlayStreamItem.cs | 12 ++++++++-- osu.Game/Overlays/OverlayTabControl.cs | 14 ++++++++++- .../Toolbar/ToolbarRulesetSelector.cs | 4 ---- .../Toolbar/ToolbarRulesetTabButton.cs | 12 ++++++++++ .../Match/Components/MatchTypePicker.cs | 11 +++++++-- 11 files changed, 119 insertions(+), 24 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index f24977927f..5ce384c53c 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -8,6 +8,8 @@ using System.Linq; using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; @@ -143,13 +145,6 @@ namespace osu.Game.Graphics.UserInterface FadeUnhovered(); } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - if (accentColour == default) - AccentColour = colours.Blue; - } - public OsuTabItem(T value) : base(value) { @@ -196,10 +191,21 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, }, - new HoverClickSounds(HoverSampleSet.TabSelect) + new HoverSounds(HoverSampleSet.TabSelect) }; } + private Sample selectSample; + + [BackgroundDependencyLoader] + private void load(OsuColour colours, AudioManager audio) + { + if (accentColour == default) + AccentColour = colours.Blue; + + selectSample = audio.Samples.Get(@"UI/tabselect-select"); + } + protected override void OnActivated() { Text.Font = Text.Font.With(weight: FontWeight.Bold); @@ -211,6 +217,8 @@ namespace osu.Game.Graphics.UserInterface Text.Font = Text.Font.With(weight: FontWeight.Medium); FadeUnhovered(); } + + protected override void OnActivatedByUser() => selectSample.Play(); } } } diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index 2fe8acfbd5..44c659f945 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -7,6 +7,8 @@ using System; using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; @@ -53,6 +55,8 @@ namespace osu.Game.Graphics.UserInterface } } + private Sample selectSample = null!; + public PageTabItem(T value) : base(value) { @@ -78,12 +82,18 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, }, - new HoverClickSounds(HoverSampleSet.TabSelect) + new HoverSounds(HoverSampleSet.TabSelect) }; Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Torus, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true); } + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + selectSample = audio.Samples.Get(@"UI/tabselect-select"); + } + protected virtual LocalisableString CreateText() => (Value as Enum)?.GetLocalisableDescription() ?? Value.ToString(); protected override bool OnHover(HoverEvent e) @@ -112,6 +122,8 @@ namespace osu.Game.Graphics.UserInterface protected override void OnActivated() => slideActive(); protected override void OnDeactivated() => slideInactive(); + + protected override void OnActivatedByUser() => selectSample.Play(); } } } diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs b/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs index 9cd0031e3d..63a533c92e 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapListingCardSizeTabControl.cs @@ -5,6 +5,8 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -47,13 +49,15 @@ namespace osu.Game.Overlays.BeatmapListing [Resolved] private OverlayColourProvider colourProvider { get; set; } + private Sample selectSample = null!; + public TabItem(BeatmapCardSize value) : base(value) { } [BackgroundDependencyLoader] - private void load() + private void load(AudioManager audio) { AutoSizeAxes = Axes.Both; Masking = true; @@ -79,8 +83,10 @@ namespace osu.Game.Overlays.BeatmapListing Icon = getIconForCardSize(Value) } }, - new HoverClickSounds(HoverSampleSet.TabSelect) + new HoverSounds(HoverSampleSet.TabSelect) }; + + selectSample = audio.Samples.Get(@"UI/tabselect-select"); } private static IconUsage getIconForCardSize(BeatmapCardSize cardSize) @@ -111,6 +117,8 @@ namespace osu.Game.Overlays.BeatmapListing updateState(); } + protected override void OnActivatedByUser() => selectSample.Play(); + protected override void OnDeactivated() { if (IsLoaded) diff --git a/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs b/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs index 831cf812ff..89bf61dd18 100644 --- a/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs +++ b/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs @@ -5,6 +5,8 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; @@ -24,13 +26,15 @@ namespace osu.Game.Overlays.BeatmapListing private OsuSpriteText text; + private Sample selectSample = null!; + public FilterTabItem(T value) : base(value) { } [BackgroundDependencyLoader] - private void load() + private void load(AudioManager audio) { AutoSizeAxes = Axes.Both; AddRangeInternal(new Drawable[] @@ -40,10 +44,12 @@ namespace osu.Game.Overlays.BeatmapListing Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular), Text = LabelFor(Value) }, - new HoverClickSounds(HoverSampleSet.TabSelect) + new HoverSounds(HoverSampleSet.TabSelect) }); Enabled.Value = true; + + selectSample = audio.Samples.Get(@"UI/tabselect-select"); } protected override void LoadComplete() @@ -71,6 +77,8 @@ namespace osu.Game.Overlays.BeatmapListing protected override void OnDeactivated() => UpdateState(); + protected override void OnActivatedByUser() => selectSample.Play(); + /// /// Returns the label text to be used for the supplied . /// diff --git a/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs b/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs index d7d6bd4a2a..c2bea0ed91 100644 --- a/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs +++ b/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs @@ -11,6 +11,8 @@ using osuTK; using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osuTK.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; @@ -65,6 +67,8 @@ namespace osu.Game.Overlays private readonly SpriteIcon icon; + private Sample selectSample = null!; + public PanelDisplayTabItem(OverlayPanelDisplayStyle value) : base(value) { @@ -78,14 +82,22 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit }, - new HoverClickSounds() + new HoverSounds(HoverSampleSet.TabSelect) }); } + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + selectSample = audio.Samples.Get(@"UI/tabselect-select"); + } + protected override void OnActivated() => updateState(); protected override void OnDeactivated() => updateState(); + protected override void OnActivatedByUser() => selectSample.Play(); + protected override bool OnHover(HoverEvent e) { updateState(); diff --git a/osu.Game/Overlays/OverlayRulesetTabItem.cs b/osu.Game/Overlays/OverlayRulesetTabItem.cs index 6d318820b3..b245486adf 100644 --- a/osu.Game/Overlays/OverlayRulesetTabItem.cs +++ b/osu.Game/Overlays/OverlayRulesetTabItem.cs @@ -10,6 +10,8 @@ using osu.Game.Rulesets; using osuTK.Graphics; using osuTK; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; using osu.Game.Graphics.Containers; @@ -39,6 +41,8 @@ namespace osu.Game.Overlays public LocalisableString TooltipText => Value.Name; + private Sample selectSample = null!; + public OverlayRulesetTabItem(RulesetInfo value) : base(value) { @@ -59,12 +63,18 @@ namespace osu.Game.Overlays Icon = value.CreateInstance().CreateIcon(), }, }, - new HoverClickSounds() + new HoverSounds(HoverSampleSet.TabSelect) }); Enabled.Value = true; } + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + selectSample = audio.Samples.Get(@"UI/tabselect-select"); + } + protected override void LoadComplete() { base.LoadComplete(); @@ -90,6 +100,8 @@ namespace osu.Game.Overlays protected override void OnDeactivated() => updateState(); + protected override void OnActivatedByUser() => selectSample.Play(); + private void updateState() { AccentColour = Enabled.Value ? getActiveColour() : colourProvider.Foreground1; diff --git a/osu.Game/Overlays/OverlayStreamItem.cs b/osu.Game/Overlays/OverlayStreamItem.cs index 45181c13e4..f0ae0b41fc 100644 --- a/osu.Game/Overlays/OverlayStreamItem.cs +++ b/osu.Game/Overlays/OverlayStreamItem.cs @@ -11,6 +11,8 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Framework.Graphics.Sprites; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Game.Graphics.Sprites; using osu.Game.Graphics; using osuTK.Graphics; @@ -49,8 +51,10 @@ namespace osu.Game.Overlays Margin = new MarginPadding(PADDING); } + private Sample selectSample; + [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider, OsuColour colours) + private void load(OverlayColourProvider colourProvider, OsuColour colours, AudioManager audio) { AddRange(new Drawable[] { @@ -87,9 +91,11 @@ namespace osu.Game.Overlays CollapsedSize = 2, Expanded = true }, - new HoverClickSounds() + new HoverSounds(HoverSampleSet.TabSelect) }); + selectSample = audio.Samples.Get(@"UI/tabselect-select"); + SelectedItem.BindValueChanged(_ => updateState(), true); } @@ -105,6 +111,8 @@ namespace osu.Game.Overlays protected override void OnDeactivated() => updateState(); + protected override void OnActivatedByUser() => selectSample.Play(); + protected override bool OnHover(HoverEvent e) { updateState(); diff --git a/osu.Game/Overlays/OverlayTabControl.cs b/osu.Game/Overlays/OverlayTabControl.cs index 884e31868f..a27caa13f1 100644 --- a/osu.Game/Overlays/OverlayTabControl.cs +++ b/osu.Game/Overlays/OverlayTabControl.cs @@ -4,6 +4,8 @@ #nullable disable using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; @@ -80,6 +82,8 @@ namespace osu.Game.Overlays } } + private Sample selectSample = null!; + public OverlayTabItem(T value) : base(value) { @@ -101,10 +105,16 @@ namespace osu.Game.Overlays ExpandedSize = 5f, CollapsedSize = 0 }, - new HoverClickSounds(HoverSampleSet.TabSelect) + new HoverSounds(HoverSampleSet.TabSelect) }; } + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + selectSample = audio.Samples.Get(@"UI/tabselect-select"); + } + protected override bool OnHover(HoverEvent e) { base.OnHover(e); @@ -136,6 +146,8 @@ namespace osu.Game.Overlays Text.Font = Text.Font.With(weight: FontWeight.Medium); } + protected override void OnActivatedByUser() => selectSample.Play(); + private void updateState() { if (Active.Value) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 723c24597a..518152e455 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -88,10 +88,6 @@ namespace osu.Game.Overlays.Toolbar if (SelectedTab != null) { ModeButtonLine.MoveToX(SelectedTab.DrawPosition.X, !hasInitialPosition ? 0 : 500, Easing.OutElasticQuarter); - - if (hasInitialPosition) - selectionSamples[SelectedTab.Value.ShortName]?.Play(); - hasInitialPosition = true; } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs index 3287ac6eaa..0315bede64 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. 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.UserInterface; @@ -17,6 +19,8 @@ namespace osu.Game.Overlays.Toolbar { private readonly RulesetButton ruleset; + private Sample? selectSample; + public ToolbarRulesetTabButton(RulesetInfo value) : base(value) { @@ -34,10 +38,18 @@ namespace osu.Game.Overlays.Toolbar ruleset.SetIcon(rInstance.CreateIcon()); } + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + selectSample = audio.Samples.Get($@"UI/ruleset-select-{Value.ShortName}"); + } + protected override void OnActivated() => ruleset.Active = true; protected override void OnDeactivated() => ruleset.Active = false; + protected override void OnActivatedByUser() => selectSample?.Play(); + private partial class RulesetButton : ToolbarButton { protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds(); diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/MatchTypePicker.cs b/osu.Game/Screens/OnlinePlay/Match/Components/MatchTypePicker.cs index 995fce085e..477336e8ea 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/MatchTypePicker.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/MatchTypePicker.cs @@ -4,6 +4,8 @@ #nullable disable using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -78,14 +80,17 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components }, }, }, - new HoverClickSounds(), + new HoverSounds(HoverSampleSet.TabSelect), }; } + private Sample selectSample; + [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, AudioManager audio) { selection.Colour = colours.Yellow; + selectSample = audio.Samples.Get(@"UI/tabselect-select"); } protected override bool OnHover(HoverEvent e) @@ -109,6 +114,8 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components { selection.FadeOut(transition_duration, Easing.OutQuint); } + + protected override void OnActivatedByUser() => selectSample.Play(); } } } From 50a21fb7273489f682b680877ad69200a2d4c227 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 17 Apr 2024 02:38:39 +0300 Subject: [PATCH 05/21] Change `ToolbarRulesetSelector` to use `SelectItem` to trigger new sound feedback path --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 518152e455..d49c340ed4 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -3,11 +3,8 @@ #nullable disable -using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -24,8 +21,6 @@ namespace osu.Game.Overlays.Toolbar { protected Drawable ModeButtonLine { get; private set; } - private readonly Dictionary selectionSamples = new Dictionary(); - public ToolbarRulesetSelector() { RelativeSizeAxes = Axes.Y; @@ -33,7 +28,7 @@ namespace osu.Game.Overlays.Toolbar } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load() { AddRangeInternal(new[] { @@ -59,9 +54,6 @@ namespace osu.Game.Overlays.Toolbar } }, }); - - foreach (var ruleset in Rulesets.AvailableRulesets) - selectionSamples[ruleset.ShortName] = audio.Samples.Get($"UI/ruleset-select-{ruleset.ShortName}"); } protected override void LoadComplete() @@ -117,7 +109,7 @@ namespace osu.Game.Overlays.Toolbar RulesetInfo found = Rulesets.AvailableRulesets.ElementAtOrDefault(requested); if (found != null) - Current.Value = found; + SelectItem(found); return true; } From 42892acc1adaf8be01897de0c4e5fef7b6319a4d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 17 Apr 2024 02:42:24 +0300 Subject: [PATCH 06/21] Fix multiple selection filter tab items no longer playing sounds These tab items are not managed by a `TabControl`, activation events are manually served by the class itself toggling `Active` when clicked. --- .../BeatmapSearchMultipleSelectionFilterRow.cs | 1 + osu.Game/Overlays/BeatmapListing/FilterTabItem.cs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs index e59beb43ff..0a4c2b1e21 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs @@ -129,6 +129,7 @@ namespace osu.Game.Overlays.BeatmapListing { base.OnClick(e); Active.Toggle(); + SelectSample.Play(); return true; } } diff --git a/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs b/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs index 89bf61dd18..ee188d34ce 100644 --- a/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs +++ b/osu.Game/Overlays/BeatmapListing/FilterTabItem.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.BeatmapListing private OsuSpriteText text; - private Sample selectSample = null!; + protected Sample SelectSample { get; private set; } = null!; public FilterTabItem(T value) : base(value) @@ -49,7 +49,7 @@ namespace osu.Game.Overlays.BeatmapListing Enabled.Value = true; - selectSample = audio.Samples.Get(@"UI/tabselect-select"); + SelectSample = audio.Samples.Get(@"UI/tabselect-select"); } protected override void LoadComplete() @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.BeatmapListing protected override void OnDeactivated() => UpdateState(); - protected override void OnActivatedByUser() => selectSample.Play(); + protected override void OnActivatedByUser() => SelectSample.Play(); /// /// Returns the label text to be used for the supplied . From 9e692686760ea1f00cf661bc011da18e8b4b43a0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 17 Apr 2024 02:48:32 +0300 Subject: [PATCH 07/21] Change editor screen selection logic to use `SelectItem` for sound feedback --- osu.Game/Screens/Edit/Editor.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index c1f6c02301..37f4b4f5be 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -372,7 +372,7 @@ namespace osu.Game.Screens.Edit } } }, - new EditorScreenSwitcherControl + screenSwitcher = new EditorScreenSwitcherControl { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, @@ -662,23 +662,23 @@ namespace osu.Game.Screens.Edit return true; case GlobalAction.EditorComposeMode: - Mode.Value = EditorScreenMode.Compose; + screenSwitcher.SelectItem(EditorScreenMode.Compose); return true; case GlobalAction.EditorDesignMode: - Mode.Value = EditorScreenMode.Design; + screenSwitcher.SelectItem(EditorScreenMode.Design); return true; case GlobalAction.EditorTimingMode: - Mode.Value = EditorScreenMode.Timing; + screenSwitcher.SelectItem(EditorScreenMode.Timing); return true; case GlobalAction.EditorSetupMode: - Mode.Value = EditorScreenMode.SongSetup; + screenSwitcher.SelectItem(EditorScreenMode.SongSetup); return true; case GlobalAction.EditorVerifyMode: - Mode.Value = EditorScreenMode.Verify; + screenSwitcher.SelectItem(EditorScreenMode.Verify); return true; case GlobalAction.EditorTestGameplay: @@ -959,6 +959,8 @@ namespace osu.Game.Screens.Edit [CanBeNull] private ScheduledDelegate playbackDisabledDebounce; + private EditorScreenSwitcherControl screenSwitcher; + private void updateSampleDisabledState() { bool shouldDisableSamples = clock.SeekingOrStopped.Value From 24e8b88320af93d257674452178e878253ccb4fc Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 17 Apr 2024 03:00:27 +0300 Subject: [PATCH 08/21] Add inline comment to the custom implementation of multiple-selection tab items --- .../BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs index 0a4c2b1e21..4bd25f6561 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs @@ -128,6 +128,9 @@ namespace osu.Game.Overlays.BeatmapListing protected override bool OnClick(ClickEvent e) { base.OnClick(e); + + // this tab item implementation is not managed by a TabControl, + // therefore we have to manually update Active state and play select sound when this tab item is clicked. Active.Toggle(); SelectSample.Play(); return true; From a7e043bdbe3b145b5e33c392e06061e9e71fc7b2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 17 Apr 2024 03:08:29 +0300 Subject: [PATCH 09/21] Fix beatmap rulest selector playing sound for initial ruleset selection --- osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs index 426fbcdb8d..29744f27fc 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapRulesetSelector.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.BeatmapSet // propagate value to tab items first to enable only available rulesets. beatmapSet.Value = value; - SelectTab(TabContainer.TabItems.FirstOrDefault(t => t.Enabled.Value)); + Current.Value = TabContainer.TabItems.FirstOrDefault(t => t.Enabled.Value)?.Value; } } From f92833b588577f6e55f53948f97a8ed284867fb0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 18 Apr 2024 12:02:49 +0800 Subject: [PATCH 10/21] Add ability to quick exit from results screen --- osu.Game/Screens/Ranking/ResultsScreen.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index e579c3fe51..f28b9b2554 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -191,6 +191,16 @@ namespace osu.Game.Screens.Ranking }); } + AddInternal(new HotkeyExitOverlay + { + Action = () => + { + if (!this.IsCurrentScreen()) return; + + this.Exit(); + }, + }); + if (player != null && AllowRetry) { buttons.Add(new RetryButton { Width = 300 }); From 46e2cfdba526d77106d1eff41ec5e542ac7e8bca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 18 Apr 2024 18:33:30 +0800 Subject: [PATCH 11/21] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 2d7a9d2652..bf02a5d8e2 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -10,7 +10,7 @@ true - + diff --git a/osu.iOS.props b/osu.iOS.props index b2e3fc0779..4f973dbeb9 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -23,6 +23,6 @@ iossimulator-x64 - + From a41ae99dd7e8f39c909a3519cce1817469b139a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 19 Apr 2024 15:14:52 +0800 Subject: [PATCH 12/21] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index bf02a5d8e2..c61977cfa3 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -10,7 +10,7 @@ true - + diff --git a/osu.iOS.props b/osu.iOS.props index 4f973dbeb9..6389172fe7 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -23,6 +23,6 @@ iossimulator-x64 - + From 362a7b2c7735fa753e81c7075dba38b4d634e1be Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 19 Apr 2024 18:03:13 +0900 Subject: [PATCH 13/21] Remove unused members from GameplaySkinComponentLookup --- osu.Game.Rulesets.Catch/CatchSkinComponentLookup.cs | 4 ---- osu.Game.Rulesets.Mania/ManiaSkinComponentLookup.cs | 4 ---- osu.Game.Rulesets.Osu/OsuSkinComponentLookup.cs | 4 ---- osu.Game.Rulesets.Taiko/TaikoSkinComponentLookup.cs | 4 ---- osu.Game/Skinning/GameplaySkinComponentLookup.cs | 3 --- 5 files changed, 19 deletions(-) diff --git a/osu.Game.Rulesets.Catch/CatchSkinComponentLookup.cs b/osu.Game.Rulesets.Catch/CatchSkinComponentLookup.cs index 149aae1cb4..596b102ac5 100644 --- a/osu.Game.Rulesets.Catch/CatchSkinComponentLookup.cs +++ b/osu.Game.Rulesets.Catch/CatchSkinComponentLookup.cs @@ -11,9 +11,5 @@ namespace osu.Game.Rulesets.Catch : base(component) { } - - protected override string RulesetPrefix => "catch"; // todo: use CatchRuleset.SHORT_NAME; - - protected override string ComponentName => Component.ToString().ToLowerInvariant(); } } diff --git a/osu.Game.Rulesets.Mania/ManiaSkinComponentLookup.cs b/osu.Game.Rulesets.Mania/ManiaSkinComponentLookup.cs index 44120e16e6..046d1c5b34 100644 --- a/osu.Game.Rulesets.Mania/ManiaSkinComponentLookup.cs +++ b/osu.Game.Rulesets.Mania/ManiaSkinComponentLookup.cs @@ -15,10 +15,6 @@ namespace osu.Game.Rulesets.Mania : base(component) { } - - protected override string RulesetPrefix => ManiaRuleset.SHORT_NAME; - - protected override string ComponentName => Component.ToString().ToLowerInvariant(); } public enum ManiaSkinComponents diff --git a/osu.Game.Rulesets.Osu/OsuSkinComponentLookup.cs b/osu.Game.Rulesets.Osu/OsuSkinComponentLookup.cs index 81d5811f85..3b3653e1ba 100644 --- a/osu.Game.Rulesets.Osu/OsuSkinComponentLookup.cs +++ b/osu.Game.Rulesets.Osu/OsuSkinComponentLookup.cs @@ -11,9 +11,5 @@ namespace osu.Game.Rulesets.Osu : base(component) { } - - protected override string RulesetPrefix => OsuRuleset.SHORT_NAME; - - protected override string ComponentName => Component.ToString().ToLowerInvariant(); } } diff --git a/osu.Game.Rulesets.Taiko/TaikoSkinComponentLookup.cs b/osu.Game.Rulesets.Taiko/TaikoSkinComponentLookup.cs index c35971e9fd..8841c3d3ca 100644 --- a/osu.Game.Rulesets.Taiko/TaikoSkinComponentLookup.cs +++ b/osu.Game.Rulesets.Taiko/TaikoSkinComponentLookup.cs @@ -11,9 +11,5 @@ namespace osu.Game.Rulesets.Taiko : base(component) { } - - protected override string RulesetPrefix => TaikoRuleset.SHORT_NAME; - - protected override string ComponentName => Component.ToString().ToLowerInvariant(); } } diff --git a/osu.Game/Skinning/GameplaySkinComponentLookup.cs b/osu.Game/Skinning/GameplaySkinComponentLookup.cs index ec159873f8..c317a17e21 100644 --- a/osu.Game/Skinning/GameplaySkinComponentLookup.cs +++ b/osu.Game/Skinning/GameplaySkinComponentLookup.cs @@ -24,8 +24,5 @@ namespace osu.Game.Skinning { Component = component; } - - protected virtual string RulesetPrefix => string.Empty; - protected virtual string ComponentName => Component.ToString(); } } From 9d04b44a8872663476798264d8ab91943768f0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 19 Apr 2024 11:04:05 +0200 Subject: [PATCH 14/21] Add failing test case --- .../UserInterface/TestSceneModSelectOverlay.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs index 6c75530a6e..8ddbd84890 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModSelectOverlay.cs @@ -612,6 +612,23 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("search text box unfocused", () => !modSelectOverlay.SearchTextBox.HasFocus); } + [Test] + public void TestSearchBoxFocusToggleRespondsToExternalChanges() + { + AddStep("text search does not start active", () => configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, false)); + createScreen(); + + AddUntilStep("search text box not focused", () => !modSelectOverlay.SearchTextBox.HasFocus); + + AddStep("press tab", () => InputManager.Key(Key.Tab)); + AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus); + + AddStep("unfocus search text box externally", () => InputManager.ChangeFocus(null)); + + AddStep("press tab", () => InputManager.Key(Key.Tab)); + AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus); + } + [Test] public void TestTextSearchDoesNotBlockCustomisationPanelKeyboardInteractions() { From 2dcbb823ef327f947547ed8f74990e74d021712d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 19 Apr 2024 11:08:34 +0200 Subject: [PATCH 15/21] Use textbox focus state directly rather than trying to track it independently --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 5ca26c739e..47362c0003 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -143,8 +143,6 @@ namespace osu.Game.Overlays.Mods protected ShearedToggleButton? CustomisationButton { get; private set; } protected SelectAllModsButton? SelectAllModsButton { get; set; } - private bool textBoxShouldFocus; - private Sample? columnAppearSample; private WorkingBeatmap? beatmap; @@ -542,7 +540,7 @@ namespace osu.Game.Overlays.Mods if (customisationVisible.Value) SearchTextBox.KillFocus(); else - setTextBoxFocus(textBoxShouldFocus); + setTextBoxFocus(textSearchStartsActive.Value); } /// @@ -798,15 +796,13 @@ namespace osu.Game.Overlays.Mods return false; // TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`) - setTextBoxFocus(!textBoxShouldFocus); + setTextBoxFocus(!SearchTextBox.HasFocus); return true; } - private void setTextBoxFocus(bool keepFocus) + private void setTextBoxFocus(bool focus) { - textBoxShouldFocus = keepFocus; - - if (textBoxShouldFocus) + if (focus) SearchTextBox.TakeFocus(); else SearchTextBox.KillFocus(); From 509862490e88f5ebea63005e23463336cb43f9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 19 Apr 2024 11:11:18 +0200 Subject: [PATCH 16/21] Revert unnecessary changes --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 47362c0003..25293e8e20 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -418,7 +418,7 @@ namespace osu.Game.Overlays.Mods yield return new ColumnDimContainer(new ModPresetColumn { Margin = new MarginPadding { Right = 10 } - }, this); + }); } yield return createModColumnContent(ModType.DifficultyReduction); @@ -436,7 +436,7 @@ namespace osu.Game.Overlays.Mods column.Margin = new MarginPadding { Right = 10 }; }); - return new ColumnDimContainer(column, this); + return new ColumnDimContainer(column); } private void createLocalMods() @@ -895,17 +895,13 @@ namespace osu.Game.Overlays.Mods [Resolved] private OsuColour colours { get; set; } = null!; - private ModSelectOverlay modSelectOverlayInstance; - - public ColumnDimContainer(ModSelectColumn column, ModSelectOverlay modSelectOverlay) + public ColumnDimContainer(ModSelectColumn column) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; Child = Column = column; column.Active.BindTo(Active); - - this.modSelectOverlayInstance = modSelectOverlay; } [BackgroundDependencyLoader] @@ -953,7 +949,7 @@ namespace osu.Game.Overlays.Mods RequestScroll?.Invoke(this); // Killing focus is done here because it's the only feasible place on ModSelectOverlay you can click on without triggering any action. - modSelectOverlayInstance.setTextBoxFocus(false); + Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null)); return true; } From ddc1b90ee1836662e788e02f266992cecad91e91 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 19 Apr 2024 20:36:24 +0900 Subject: [PATCH 17/21] Remove unused method --- .../Skinning/ISerialisableDrawableContainer.cs | 5 ----- osu.Game/Skinning/SkinComponentsContainer.cs | 15 --------------- 2 files changed, 20 deletions(-) diff --git a/osu.Game/Skinning/ISerialisableDrawableContainer.cs b/osu.Game/Skinning/ISerialisableDrawableContainer.cs index a19c8c5162..57ea75bc7e 100644 --- a/osu.Game/Skinning/ISerialisableDrawableContainer.cs +++ b/osu.Game/Skinning/ISerialisableDrawableContainer.cs @@ -30,11 +30,6 @@ namespace osu.Game.Skinning /// void Reload(); - /// - /// Reload this target from the provided skinnable information. - /// - void Reload(SerialisedDrawableInfo[] skinnableInfo); - /// /// Add a new skinnable component to this target. /// diff --git a/osu.Game/Skinning/SkinComponentsContainer.cs b/osu.Game/Skinning/SkinComponentsContainer.cs index adf0a288b4..02ba43fd39 100644 --- a/osu.Game/Skinning/SkinComponentsContainer.cs +++ b/osu.Game/Skinning/SkinComponentsContainer.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Collections.Generic; using System.Linq; using System.Threading; using osu.Framework.Bindables; @@ -44,20 +43,6 @@ namespace osu.Game.Skinning Lookup = lookup; } - public void Reload(SerialisedDrawableInfo[] skinnableInfo) - { - var drawables = new List(); - - foreach (var i in skinnableInfo) - drawables.Add(i.CreateInstance()); - - Reload(new Container - { - RelativeSizeAxes = Axes.Both, - Children = drawables, - }); - } - public void Reload() => Reload(CurrentSkin.GetDrawableComponent(Lookup) as Container); public void Reload(Container? componentsContainer) From bac70da1a1a12ddae4769da8ead2374ed6932311 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 19 Apr 2024 21:40:02 +0900 Subject: [PATCH 18/21] Give SerialisedDrawableInfo sane defaults --- osu.Game/Skinning/SerialisedDrawableInfo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Skinning/SerialisedDrawableInfo.cs b/osu.Game/Skinning/SerialisedDrawableInfo.cs index 2d6113ff70..ac1aa80d29 100644 --- a/osu.Game/Skinning/SerialisedDrawableInfo.cs +++ b/osu.Game/Skinning/SerialisedDrawableInfo.cs @@ -34,15 +34,15 @@ namespace osu.Game.Skinning public float Rotation { get; set; } - public Vector2 Scale { get; set; } + public Vector2 Scale { get; set; } = Vector2.One; public float? Width { get; set; } public float? Height { get; set; } - public Anchor Anchor { get; set; } + public Anchor Anchor { get; set; } = Anchor.TopLeft; - public Anchor Origin { get; set; } + public Anchor Origin { get; set; } = Anchor.TopLeft; /// public bool UsesFixedAnchor { get; set; } From 4cffc39dffde5e14172df2693e71eebb4f3964ad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 20 Apr 2024 04:53:31 +0800 Subject: [PATCH 19/21] Don't require hold for quick exit at results screen --- osu.Game/Screens/Ranking/ResultsScreen.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index f28b9b2554..ebb0530046 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -191,16 +191,6 @@ namespace osu.Game.Screens.Ranking }); } - AddInternal(new HotkeyExitOverlay - { - Action = () => - { - if (!this.IsCurrentScreen()) return; - - this.Exit(); - }, - }); - if (player != null && AllowRetry) { buttons.Add(new RetryButton { Width = 300 }); @@ -400,6 +390,15 @@ namespace osu.Game.Screens.Ranking switch (e.Action) { + case GlobalAction.QuickExit: + if (this.IsCurrentScreen()) + { + this.Exit(); + return true; + } + + break; + case GlobalAction.Select: StatisticsPanel.ToggleVisibility(); return true; From 722fa228cedfb81726dcc08e7b2baa4c524fb958 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 21 Apr 2024 17:40:35 +0300 Subject: [PATCH 20/21] Don't consider editor table content for input --- osu.Game/Screens/Edit/EditorTable.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Edit/EditorTable.cs b/osu.Game/Screens/Edit/EditorTable.cs index e5dc540b06..49b41fac21 100644 --- a/osu.Game/Screens/Edit/EditorTable.cs +++ b/osu.Game/Screens/Edit/EditorTable.cs @@ -30,6 +30,10 @@ namespace osu.Game.Screens.Edit protected readonly FillFlowContainer BackgroundFlow; + // We can avoid potentially thousands of objects being added to the input sub-tree since item selection is being handled by the BackgroundFlow + // and no items in the underlying table are clickable. + protected override bool ShouldBeConsideredForInput(Drawable child) => base.ShouldBeConsideredForInput(child) && child == BackgroundFlow; + protected EditorTable() { RelativeSizeAxes = Axes.X; From 1d3fd65d86f517805f573517ad7650d1a89277af Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Mon, 22 Apr 2024 07:02:49 +0300 Subject: [PATCH 21/21] Adjust execution order --- osu.Game/Screens/Edit/EditorTable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/EditorTable.cs b/osu.Game/Screens/Edit/EditorTable.cs index 49b41fac21..4d8393e829 100644 --- a/osu.Game/Screens/Edit/EditorTable.cs +++ b/osu.Game/Screens/Edit/EditorTable.cs @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Edit // We can avoid potentially thousands of objects being added to the input sub-tree since item selection is being handled by the BackgroundFlow // and no items in the underlying table are clickable. - protected override bool ShouldBeConsideredForInput(Drawable child) => base.ShouldBeConsideredForInput(child) && child == BackgroundFlow; + protected override bool ShouldBeConsideredForInput(Drawable child) => child == BackgroundFlow && base.ShouldBeConsideredForInput(child); protected EditorTable() {