1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Add a sound for 'cancelling' ProgessNotification

This commit is contained in:
Jamie Taylor 2023-07-05 17:27:42 +09:00
parent 4ff4c3a12e
commit 6e2b7f433b
No known key found for this signature in database
GPG Key ID: 2ACFA8B6370B8C8C

View File

@ -4,6 +4,8 @@
using System; using System;
using System.Threading; using System.Threading;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
@ -122,6 +124,7 @@ namespace osu.Game.Overlays.Notifications
cancellationTokenSource.Cancel(); cancellationTokenSource.Cancel();
IconContent.FadeColour(ColourInfo.GradientVertical(Color4.Gray, Color4.Gray.Lighten(0.5f)), colour_fade_duration); IconContent.FadeColour(ColourInfo.GradientVertical(Color4.Gray, Color4.Gray.Lighten(0.5f)), colour_fade_duration);
cancelSample?.Play();
loadingSpinner.Hide(); loadingSpinner.Hide();
var icon = new SpriteIcon var icon = new SpriteIcon
@ -190,6 +193,8 @@ namespace osu.Game.Overlays.Notifications
private LoadingSpinner loadingSpinner = null!; private LoadingSpinner loadingSpinner = null!;
private Sample? cancelSample;
private readonly TextFlowContainer textDrawable; private readonly TextFlowContainer textDrawable;
public ProgressNotification() public ProgressNotification()
@ -217,7 +222,7 @@ namespace osu.Game.Overlays.Notifications
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours, AudioManager audioManager)
{ {
colourQueued = colours.YellowDark; colourQueued = colours.YellowDark;
colourActive = colours.Blue; colourActive = colours.Blue;
@ -236,6 +241,8 @@ namespace osu.Game.Overlays.Notifications
Size = new Vector2(loading_spinner_size), Size = new Vector2(loading_spinner_size),
} }
}); });
cancelSample = audioManager.Samples.Get(@"UI/notification-cancel");
} }
public override void Close(bool runFlingAnimation) public override void Close(bool runFlingAnimation)