diff --git a/osu.Game/Online/Chat/MessageNotifier.cs b/osu.Game/Online/Chat/MessageNotifier.cs
index ae249d1b7f..65aac723da 100644
--- a/osu.Game/Online/Chat/MessageNotifier.cs
+++ b/osu.Game/Online/Chat/MessageNotifier.cs
@@ -171,6 +171,8 @@ namespace osu.Game.Online.Chat
public abstract partial class HighlightMessageNotification : SimpleNotification
{
+ public override string PopInSampleName => "UI/notification-mention";
+
protected HighlightMessageNotification(Message message, Channel channel)
{
this.message = message;
diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs
index 21027b0931..d21ad625c1 100644
--- a/osu.Game/Overlays/NotificationOverlay.cs
+++ b/osu.Game/Overlays/NotificationOverlay.cs
@@ -169,7 +169,7 @@ namespace osu.Game.Overlays
Logger.Log($"⚠️ {notification.Text}");
- notification.Closed += notificationClosed;
+ notification.Closed += () => notificationClosed(notification);
if (notification is IHasCompletionTarget hasCompletionTarget)
hasCompletionTarget.CompletionTarget = Post;
@@ -229,17 +229,20 @@ namespace osu.Game.Overlays
mainContent.FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.In);
}
- private void notificationClosed() => Schedule(() =>
+ private void notificationClosed(Notification notification) => Schedule(() =>
{
updateCounts();
// this debounce is currently shared between popin/popout sounds, which means one could potentially not play when the user is expecting it.
// popout is constant across all notification types, and should therefore be handled using playback concurrency instead, but seems broken at the moment.
- playDebouncedSample("UI/overlay-pop-out");
+ playDebouncedSample(notification.PopOutSampleName);
});
private void playDebouncedSample(string sampleName)
{
+ if (string.IsNullOrEmpty(sampleName))
+ return;
+
if (lastSamplePlayback == null || Time.Current - lastSamplePlayback > OsuGameBase.SAMPLE_DEBOUNCE_TIME)
{
audio.Samples.Get(sampleName)?.Play();
diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs
index 77d3317b1f..8cdc373417 100644
--- a/osu.Game/Overlays/Notifications/Notification.cs
+++ b/osu.Game/Overlays/Notifications/Notification.cs
@@ -50,7 +50,8 @@ namespace osu.Game.Overlays.Notifications
///
public virtual bool DisplayOnTop => true;
- public virtual string PopInSampleName => "UI/notification-pop-in";
+ public virtual string PopInSampleName => "UI/notification-default";
+ public virtual string PopOutSampleName => "UI/overlay-pop-out";
protected NotificationLight Light;
diff --git a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs
index 46972d4b5e..93286d9d36 100644
--- a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs
+++ b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs
@@ -10,6 +10,8 @@ namespace osu.Game.Overlays.Notifications
{
public partial class ProgressCompletionNotification : SimpleNotification
{
+ public override string PopInSampleName => "UI/notification-done";
+
public ProgressCompletionNotification()
{
Icon = FontAwesome.Solid.Check;
diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs
index e6662e2179..53ac490297 100644
--- a/osu.Game/Overlays/Notifications/ProgressNotification.cs
+++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs
@@ -4,6 +4,8 @@
using System;
using System.Threading;
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.Colour;
@@ -27,6 +29,8 @@ namespace osu.Game.Overlays.Notifications
protected override bool AllowFlingDismiss => false;
+ public override string PopOutSampleName => State is ProgressNotificationState.Cancelled ? base.PopOutSampleName : "";
+
///
/// The function to post completion notifications back to.
///
@@ -122,6 +126,7 @@ namespace osu.Game.Overlays.Notifications
cancellationTokenSource.Cancel();
IconContent.FadeColour(ColourInfo.GradientVertical(Color4.Gray, Color4.Gray.Lighten(0.5f)), colour_fade_duration);
+ cancelSample?.Play();
loadingSpinner.Hide();
var icon = new SpriteIcon
@@ -190,6 +195,8 @@ namespace osu.Game.Overlays.Notifications
private LoadingSpinner loadingSpinner = null!;
+ private Sample? cancelSample;
+
private readonly TextFlowContainer textDrawable;
public ProgressNotification()
@@ -217,7 +224,7 @@ namespace osu.Game.Overlays.Notifications
}
[BackgroundDependencyLoader]
- private void load(OsuColour colours)
+ private void load(OsuColour colours, AudioManager audioManager)
{
colourQueued = colours.YellowDark;
colourActive = colours.Blue;
@@ -236,6 +243,8 @@ namespace osu.Game.Overlays.Notifications
Size = new Vector2(loading_spinner_size),
}
});
+
+ cancelSample = audioManager.Samples.Get(@"UI/notification-cancel");
}
public override void Close(bool runFlingAnimation)
diff --git a/osu.Game/Overlays/Notifications/SimpleErrorNotification.cs b/osu.Game/Overlays/Notifications/SimpleErrorNotification.cs
index 758eea93d4..81e3b40ffc 100644
--- a/osu.Game/Overlays/Notifications/SimpleErrorNotification.cs
+++ b/osu.Game/Overlays/Notifications/SimpleErrorNotification.cs
@@ -7,7 +7,7 @@ namespace osu.Game.Overlays.Notifications
{
public partial class SimpleErrorNotification : SimpleNotification
{
- public override string PopInSampleName => "UI/error-notification-pop-in";
+ public override string PopInSampleName => "UI/notification-error";
public SimpleErrorNotification()
{
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 41712f428a..20b1574617 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -37,7 +37,7 @@
-
+