From b15a54c91428cd8a0af019f6acc17c3b0a21318b Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 17 Aug 2023 11:36:00 +0900 Subject: [PATCH 01/12] Use new overlay pop-in/pop-out samples --- osu.Game/Overlays/ChatOverlay.cs | 3 +++ osu.Game/Overlays/WaveOverlayContainer.cs | 1 + osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs | 3 +++ 3 files changed, 7 insertions(+) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 87df08ceec..a47d10c565 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -55,6 +55,9 @@ namespace osu.Game.Overlays private const float side_bar_width = 190; private const float chat_bar_height = 60; + protected override string PopInSampleName => @"UI/overlay-big-pop-in"; + protected override string PopOutSampleName => @"UI/overlay-big-pop-out"; + [Resolved] private OsuConfigManager config { get; set; } = null!; diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 153f7f5412..848d9e60b7 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -19,6 +19,7 @@ namespace osu.Game.Overlays protected override bool StartHidden => true; protected override string PopInSampleName => "UI/wave-pop-in"; + protected override string PopOutSampleName => "UI/overlay-big-pop-out"; public const float HORIZONTAL_PADDING = 50; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index 5753c268d9..7b631ebfea 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -32,6 +32,9 @@ namespace osu.Game.Screens.Select.Options public override bool BlockScreenWideMouse => false; + protected override string PopInSampleName => "SongSelect/options-pop-in"; + protected override string PopOutSampleName => "SongSelect/options-pop-out"; + public BeatmapOptionsOverlay() { AutoSizeAxes = Axes.Y; From 04a1f6a5085e0cc076abba71068d4b8d1031c0ab Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 17 Aug 2023 11:37:07 +0900 Subject: [PATCH 02/12] Add panning to certain overlay pop-in/pop-outs --- .../Containers/OsuFocusedOverlayContainer.cs | 15 +++++++++++---- osu.Game/Overlays/LoginOverlay.cs | 2 ++ osu.Game/Overlays/NotificationOverlay.cs | 2 ++ osu.Game/Overlays/SettingsPanel.cs | 1 + 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index f92cfc2306..162c4b6a59 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -24,6 +24,7 @@ namespace osu.Game.Graphics.Containers private Sample samplePopOut; protected virtual string PopInSampleName => "UI/overlay-pop-in"; protected virtual string PopOutSampleName => "UI/overlay-pop-out"; + protected virtual double PopInOutSampleBalance => 0; protected override bool BlockNonPositionalInput => true; @@ -133,15 +134,21 @@ namespace osu.Game.Graphics.Containers return; } - if (didChange) - samplePopIn?.Play(); + if (didChange && samplePopIn != null) + { + samplePopIn.Balance.Value = PopInOutSampleBalance; + samplePopIn.Play(); + } if (BlockScreenWideMouse && DimMainContent) overlayManager?.ShowBlockingOverlay(this); break; case Visibility.Hidden: - if (didChange) - samplePopOut?.Play(); + if (didChange && samplePopOut != null) + { + samplePopOut.Balance.Value = PopInOutSampleBalance; + samplePopOut.Play(); + } if (BlockScreenWideMouse) overlayManager?.HideBlockingOverlay(this); break; diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index a575253e71..8a4bda89d9 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -20,6 +20,8 @@ namespace osu.Game.Overlays private const float transition_time = 400; + protected override double PopInOutSampleBalance => OsuGameBase.SFX_STEREO_STRENGTH; + [Cached] private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index c9d09848f8..ef181830b7 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -31,6 +31,8 @@ namespace osu.Game.Overlays public LocalisableString Title => NotificationsStrings.HeaderTitle; public LocalisableString Description => NotificationsStrings.HeaderDescription; + protected override double PopInOutSampleBalance => OsuGameBase.SFX_STEREO_STRENGTH; + public const float WIDTH = 320; public const float TRANSITION_LENGTH = 600; diff --git a/osu.Game/Overlays/SettingsPanel.cs b/osu.Game/Overlays/SettingsPanel.cs index d7f39a9d8f..58c56a5514 100644 --- a/osu.Game/Overlays/SettingsPanel.cs +++ b/osu.Game/Overlays/SettingsPanel.cs @@ -56,6 +56,7 @@ namespace osu.Game.Overlays private SeekLimitedSearchTextBox searchTextBox; protected override string PopInSampleName => "UI/settings-pop-in"; + protected override double PopInOutSampleBalance => -OsuGameBase.SFX_STEREO_STRENGTH; private readonly bool showSidebar; From 3d7ba0e18cdc9c739119125243c73a205e3f4fcb Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 17 Aug 2023 17:03:45 +0900 Subject: [PATCH 03/12] Add pop-in/pop-out sfx to more overlays --- .../Collections/ManageCollectionsDialog.cs | 3 +++ .../Graphics/UserInterfaceV2/OsuPopover.cs | 25 ++++++++++++++++++- .../Screens/Edit/Setup/LabelledFileChooser.cs | 3 +++ .../OnlinePlay/Lounge/DrawableLoungeRoom.cs | 2 ++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/osu.Game/Collections/ManageCollectionsDialog.cs b/osu.Game/Collections/ManageCollectionsDialog.cs index 31016b807b..cc0f23d030 100644 --- a/osu.Game/Collections/ManageCollectionsDialog.cs +++ b/osu.Game/Collections/ManageCollectionsDialog.cs @@ -23,6 +23,9 @@ namespace osu.Game.Collections private AudioFilter lowPassFilter = null!; + protected override string PopInSampleName => @"UI/overlay-big-pop-in"; + protected override string PopOutSampleName => @"UI/overlay-big-pop-out"; + public ManageCollectionsDialog() { Anchor = Anchor.Centre; diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs b/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs index 381193d539..2aa42d0d50 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuPopover.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; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -21,6 +23,16 @@ namespace osu.Game.Graphics.UserInterfaceV2 private const float fade_duration = 250; private const double scale_duration = 500; + private Sample? samplePopIn; + private Sample? samplePopOut; + protected virtual string PopInSampleName => "UI/overlay-pop-in"; + protected virtual string PopOutSampleName => "UI/overlay-pop-out"; + + // required due to LoadAsyncComplete() calling PopOut() during load - similar workaround to `OsuDropdownMenu` + private bool wasOpened; + + protected virtual bool PlayPopInOutSamples => true; + public OsuPopover(bool withPadding = true) { Content.Padding = withPadding ? new MarginPadding(20) : new MarginPadding(); @@ -38,9 +50,11 @@ namespace osu.Game.Graphics.UserInterfaceV2 } [BackgroundDependencyLoader(true)] - private void load(OverlayColourProvider? colourProvider, OsuColour colours) + private void load(OverlayColourProvider? colourProvider, OsuColour colours, AudioManager audio) { Background.Colour = Arrow.Colour = colourProvider?.Background4 ?? colours.GreySeaFoamDarker; + samplePopIn = audio.Samples.Get(PopInSampleName); + samplePopOut = audio.Samples.Get(PopOutSampleName); } protected override Drawable CreateArrow() => Empty(); @@ -49,12 +63,21 @@ namespace osu.Game.Graphics.UserInterfaceV2 { this.ScaleTo(1, scale_duration, Easing.OutElasticHalf); this.FadeIn(fade_duration, Easing.OutQuint); + + if (PlayPopInOutSamples) + { + samplePopIn?.Play(); + wasOpened = true; + } } protected override void PopOut() { this.ScaleTo(0.7f, scale_duration, Easing.OutQuint); this.FadeOut(fade_duration, Easing.OutQuint); + + if (wasOpened && PlayPopInOutSamples) + samplePopOut?.Play(); } protected override bool OnKeyDown(KeyDownEvent e) diff --git a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs index d14357e875..61f33c4bdc 100644 --- a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs +++ b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs @@ -114,6 +114,9 @@ namespace osu.Game.Screens.Edit.Setup private partial class FileChooserPopover : OsuPopover { + protected override string PopInSampleName => "UI/overlay-big-pop-in"; + protected override string PopOutSampleName => "UI/overlay-big-pop-out"; + public FileChooserPopover(string[] handledExtensions, Bindable currentFile, string? chooserPath) { Child = new Container diff --git a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs index 70e4b2a589..030408de84 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs @@ -191,6 +191,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge protected override bool BlockNonPositionalInput => true; + protected override bool PlayPopInOutSamples => false; + public PasswordEntryPopover(Room room) { this.room = room; From d10d7b6ea41f994c586725e127647b171634fae9 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 17 Aug 2023 17:07:02 +0900 Subject: [PATCH 04/12] Change some component samples to go better with overlay pop-in samples --- osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs | 4 ++-- osu.Game/Graphics/UserInterface/ShearedToggleButton.cs | 5 +++++ osu.Game/Overlays/Mods/AddPresetButton.cs | 2 ++ .../Screens/Edit/Compose/Components/BeatDivisorControl.cs | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index de4df96942..0eec04541c 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -46,8 +46,8 @@ namespace osu.Game.Graphics.UserInterface private readonly Container content; private readonly Box hover; - public OsuAnimatedButton() - : base(HoverSampleSet.Button) + public OsuAnimatedButton(HoverSampleSet sampleSet = HoverSampleSet.Button) + : base(sampleSet) { base.Content.Add(content = new Container { diff --git a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs index d5e0abe9d8..07ee26749a 100644 --- a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs @@ -14,6 +14,8 @@ namespace osu.Game.Graphics.UserInterface private Sample? sampleOff; private Sample? sampleOn; + protected virtual bool PlayClickSampleOnly => false; + /// /// Whether this button is currently toggled to an active state. /// @@ -68,6 +70,9 @@ namespace osu.Game.Graphics.UserInterface { sampleClick?.Play(); + if (PlayClickSampleOnly) + return; + if (Active.Value) sampleOn?.Play(); else diff --git a/osu.Game/Overlays/Mods/AddPresetButton.cs b/osu.Game/Overlays/Mods/AddPresetButton.cs index 731079d1d9..9063fd54f5 100644 --- a/osu.Game/Overlays/Mods/AddPresetButton.cs +++ b/osu.Game/Overlays/Mods/AddPresetButton.cs @@ -18,6 +18,8 @@ namespace osu.Game.Overlays.Mods { public partial class AddPresetButton : ShearedToggleButton, IHasPopover { + protected override bool PlayClickSampleOnly => true; + [Resolved] private OsuColour colours { get; set; } = null!; diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index 59b0bd1785..e36f1e9cad 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -262,6 +262,7 @@ namespace osu.Game.Screens.Edit.Compose.Components private readonly OsuSpriteText divisorText; public DivisorDisplay() + : base(HoverSampleSet.Default) { Anchor = Anchor.Centre; Origin = Anchor.Centre; From c811546868cb8754a32049bdfbd9bc22ab0be171 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 17 Aug 2023 21:09:50 +0900 Subject: [PATCH 05/12] Update resources --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a5a9387e36..a2afcd7a9f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -37,7 +37,7 @@ - + From fc2fac577fcdb1d329b83e2cb2e30fc5e7ea78ac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Aug 2023 17:05:25 +0900 Subject: [PATCH 06/12] Inverse and xmldoc `ShearedToggleButton` sample allowance bool --- .../UserInterface/ShearedToggleButton.cs | 20 +++++++++++-------- osu.Game/Overlays/Mods/AddPresetButton.cs | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs index 07ee26749a..05ed531d02 100644 --- a/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedToggleButton.cs @@ -14,7 +14,11 @@ namespace osu.Game.Graphics.UserInterface private Sample? sampleOff; private Sample? sampleOn; - protected virtual bool PlayClickSampleOnly => false; + /// + /// Sheared toggle buttons by default play two samples when toggled: a click and a toggle (on/off). + /// Sometimes this might be too much. Setting this to false will silence the toggle sound. + /// + protected virtual bool PlayToggleSamples => true; /// /// Whether this button is currently toggled to an active state. @@ -70,13 +74,13 @@ namespace osu.Game.Graphics.UserInterface { sampleClick?.Play(); - if (PlayClickSampleOnly) - return; - - if (Active.Value) - sampleOn?.Play(); - else - sampleOff?.Play(); + if (PlayToggleSamples) + { + if (Active.Value) + sampleOn?.Play(); + else + sampleOff?.Play(); + } } } } diff --git a/osu.Game/Overlays/Mods/AddPresetButton.cs b/osu.Game/Overlays/Mods/AddPresetButton.cs index 9063fd54f5..276afd9bec 100644 --- a/osu.Game/Overlays/Mods/AddPresetButton.cs +++ b/osu.Game/Overlays/Mods/AddPresetButton.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Mods { public partial class AddPresetButton : ShearedToggleButton, IHasPopover { - protected override bool PlayClickSampleOnly => true; + protected override bool PlayToggleSamples => false; [Resolved] private OsuColour colours { get; set; } = null!; From 75750957c7cd93a2cac7d0090d146c214239eed2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Aug 2023 17:09:13 +0900 Subject: [PATCH 07/12] Add note about why pop in samples are disabled for `PasswordEntryPopover` --- osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs index 030408de84..a45583a2ec 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs @@ -191,6 +191,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge protected override bool BlockNonPositionalInput => true; + // When a room is clicked, it already plays a click sound, which clashes pretty badly with the pop in sound. + // Dunno about this one. I'd probably remove the click sound from the panel in cases they are password protected and play these pop in / out sounds. protected override bool PlayPopInOutSamples => false; public PasswordEntryPopover(Room room) From 2e27a476bb3c4b90d08384cfda3da7e60774e278 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 24 Aug 2023 18:04:47 +0900 Subject: [PATCH 08/12] Re-enable sample playback for `PasswordEntryPopover` and remove `sampleJoin` playback instead --- osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs | 11 +++-------- .../Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs | 5 ----- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs b/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs index 2aa42d0d50..551468beb9 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs @@ -31,8 +31,6 @@ namespace osu.Game.Graphics.UserInterfaceV2 // required due to LoadAsyncComplete() calling PopOut() during load - similar workaround to `OsuDropdownMenu` private bool wasOpened; - protected virtual bool PlayPopInOutSamples => true; - public OsuPopover(bool withPadding = true) { Content.Padding = withPadding ? new MarginPadding(20) : new MarginPadding(); @@ -64,11 +62,8 @@ namespace osu.Game.Graphics.UserInterfaceV2 this.ScaleTo(1, scale_duration, Easing.OutElasticHalf); this.FadeIn(fade_duration, Easing.OutQuint); - if (PlayPopInOutSamples) - { - samplePopIn?.Play(); - wasOpened = true; - } + samplePopIn?.Play(); + wasOpened = true; } protected override void PopOut() @@ -76,7 +71,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 this.ScaleTo(0.7f, scale_duration, Easing.OutQuint); this.FadeOut(fade_duration, Easing.OutQuint); - if (wasOpened && PlayPopInOutSamples) + if (wasOpened) samplePopOut?.Play(); } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs index a45583a2ec..5cf2f91ff4 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs @@ -170,7 +170,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge if (Room.HasPassword.Value) { - sampleJoin?.Play(); this.ShowPopover(); return true; } @@ -191,10 +190,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge protected override bool BlockNonPositionalInput => true; - // When a room is clicked, it already plays a click sound, which clashes pretty badly with the pop in sound. - // Dunno about this one. I'd probably remove the click sound from the panel in cases they are password protected and play these pop in / out sounds. - protected override bool PlayPopInOutSamples => false; - public PasswordEntryPopover(Room room) { this.room = room; From 7ef5a71e91a56a3e8340393376a97973ceb3e266 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 24 Aug 2023 18:13:23 +0900 Subject: [PATCH 09/12] Move PopIn/PopOut sample playback from `WaveOverlayContainer` to `WaveContainer` (so Multiplayer/Lounge plays the samples) --- osu.Game/Graphics/Containers/WaveContainer.cs | 22 +++++++++++++++++++ osu.Game/Overlays/WaveOverlayContainer.cs | 5 +++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/WaveContainer.cs b/osu.Game/Graphics/Containers/WaveContainer.cs index 9fd3d103c9..0b1d44ccba 100644 --- a/osu.Game/Graphics/Containers/WaveContainer.cs +++ b/osu.Game/Graphics/Containers/WaveContainer.cs @@ -2,6 +2,9 @@ // See the LICENCE file in the repository root for full licence text. 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; @@ -32,6 +35,13 @@ namespace osu.Game.Graphics.Containers protected override bool StartHidden => true; + private Sample? samplePopIn; + private Sample? samplePopOut; + protected virtual string PopInSampleName => "UI/wave-pop-in"; + protected virtual string PopOutSampleName => "UI/overlay-big-pop-out"; + + private bool wasShown = false; + public Color4 FirstWaveColour { get => firstWave.Colour; @@ -56,6 +66,13 @@ namespace osu.Game.Graphics.Containers set => fourthWave.Colour = value; } + [BackgroundDependencyLoader(true)] + private void load(AudioManager audio) + { + samplePopIn = audio.Samples.Get(PopInSampleName); + samplePopOut = audio.Samples.Get(PopOutSampleName); + } + public WaveContainer() { Masking = true; @@ -110,6 +127,8 @@ namespace osu.Game.Graphics.Containers w.Show(); contentContainer.MoveToY(0, APPEAR_DURATION, Easing.OutQuint); + samplePopIn?.Play(); + wasShown = true; } protected override void PopOut() @@ -118,6 +137,9 @@ namespace osu.Game.Graphics.Containers w.Hide(); contentContainer.MoveToY(2, DISAPPEAR_DURATION, Easing.In); + + if (wasShown) + samplePopOut?.Play(); } protected override void UpdateAfterChildren() diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 848d9e60b7..b0ddef5c2b 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -18,8 +18,9 @@ namespace osu.Game.Overlays protected override bool StartHidden => true; - protected override string PopInSampleName => "UI/wave-pop-in"; - protected override string PopOutSampleName => "UI/overlay-big-pop-out"; + // `WaveContainer` plays PopIn/PopOut samples, so we disable the overlay-level one as to not double-up sample playback. + protected override string PopInSampleName => ""; + protected override string PopOutSampleName => ""; public const float HORIZONTAL_PADDING = 50; From f4415a5bab9aec67ea77af89c794921dae6a8c4e Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 24 Aug 2023 18:20:36 +0900 Subject: [PATCH 10/12] Add more detail to comment --- osu.Game/Graphics/Containers/WaveContainer.cs | 3 ++- osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/WaveContainer.cs b/osu.Game/Graphics/Containers/WaveContainer.cs index 0b1d44ccba..09d1f7e9a4 100644 --- a/osu.Game/Graphics/Containers/WaveContainer.cs +++ b/osu.Game/Graphics/Containers/WaveContainer.cs @@ -40,7 +40,8 @@ namespace osu.Game.Graphics.Containers protected virtual string PopInSampleName => "UI/wave-pop-in"; protected virtual string PopOutSampleName => "UI/overlay-big-pop-out"; - private bool wasShown = false; + // required due to LoadAsyncComplete() in `VisibilityContainer` calling PopOut() during load - similar workaround to `OsuDropdownMenu` + private bool wasShown; public Color4 FirstWaveColour { diff --git a/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs b/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs index 551468beb9..9b4689958c 100644 --- a/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs +++ b/osu.Game/Graphics/UserInterfaceV2/OsuPopover.cs @@ -28,7 +28,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 protected virtual string PopInSampleName => "UI/overlay-pop-in"; protected virtual string PopOutSampleName => "UI/overlay-pop-out"; - // required due to LoadAsyncComplete() calling PopOut() during load - similar workaround to `OsuDropdownMenu` + // required due to LoadAsyncComplete() in `VisibilityContainer` calling PopOut() during load - similar workaround to `OsuDropdownMenu` private bool wasOpened; public OsuPopover(bool withPadding = true) From 35cdd6d8661b2b4df2735e4128c3334fd014670f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Aug 2023 01:07:07 +0900 Subject: [PATCH 11/12] Use `string.Empty` --- osu.Game/Overlays/WaveOverlayContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index b0ddef5c2b..0295ff467a 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -19,8 +19,8 @@ namespace osu.Game.Overlays protected override bool StartHidden => true; // `WaveContainer` plays PopIn/PopOut samples, so we disable the overlay-level one as to not double-up sample playback. - protected override string PopInSampleName => ""; - protected override string PopOutSampleName => ""; + protected override string PopInSampleName => string.Empty; + protected override string PopOutSampleName => string.Empty; public const float HORIZONTAL_PADDING = 50; From bf0f4fddad3c2c5e6a54b41333fea68daef82b2c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Aug 2023 01:08:22 +0900 Subject: [PATCH 12/12] Localise non-overridden samples --- osu.Game/Graphics/Containers/WaveContainer.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Containers/WaveContainer.cs b/osu.Game/Graphics/Containers/WaveContainer.cs index 09d1f7e9a4..e84cb276a4 100644 --- a/osu.Game/Graphics/Containers/WaveContainer.cs +++ b/osu.Game/Graphics/Containers/WaveContainer.cs @@ -37,8 +37,6 @@ namespace osu.Game.Graphics.Containers private Sample? samplePopIn; private Sample? samplePopOut; - protected virtual string PopInSampleName => "UI/wave-pop-in"; - protected virtual string PopOutSampleName => "UI/overlay-big-pop-out"; // required due to LoadAsyncComplete() in `VisibilityContainer` calling PopOut() during load - similar workaround to `OsuDropdownMenu` private bool wasShown; @@ -70,8 +68,8 @@ namespace osu.Game.Graphics.Containers [BackgroundDependencyLoader(true)] private void load(AudioManager audio) { - samplePopIn = audio.Samples.Get(PopInSampleName); - samplePopOut = audio.Samples.Get(PopOutSampleName); + samplePopIn = audio.Samples.Get("UI/wave-pop-in"); + samplePopOut = audio.Samples.Get("UI/overlay-big-pop-out"); } public WaveContainer()