diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 2e9087fdbd..36a9baac67 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -3,6 +3,9 @@ using System.Collections.Generic; using System.Linq; +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; @@ -28,6 +31,9 @@ namespace osu.Game.Overlays.Dialog private readonly Vector2 ringMinifiedSize = new Vector2(20f); private readonly Vector2 buttonsEnterSpacing = new Vector2(0f, 50f); + private readonly Box flashLayer; + private Sample flashSample = null!; + private readonly Container content; private readonly Container ring; private readonly FillFlowContainer buttonsContainer; @@ -208,6 +214,13 @@ namespace osu.Game.Overlays.Dialog AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, }, + flashLayer = new Box + { + Alpha = 0, + RelativeSizeAxes = Axes.Both, + Blending = BlendingParameters.Additive, + Colour = Color4Extensions.FromHex(@"221a21"), + }, }, }, }; @@ -217,6 +230,12 @@ namespace osu.Game.Overlays.Dialog Show(); } + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + flashSample = audio.Samples.Get(@"UI/default-select-disabled"); + } + /// /// Programmatically clicks the first . /// @@ -232,6 +251,14 @@ namespace osu.Game.Overlays.Dialog Scheduler.AddOnce(() => Buttons.OfType().FirstOrDefault()?.TriggerClick()); } + public void Flash() + { + flashLayer.FadeInFromZero(80, Easing.OutQuint) + .Then() + .FadeOutFromOne(1500, Easing.OutQuint); + flashSample.Play(); + } + protected override bool OnKeyDown(KeyDownEvent e) { if (e.Repeat) return false; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 1cdca5754d..1b2e4785db 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -714,8 +714,11 @@ namespace osu.Game.Screens.Edit } // if the dialog is already displayed, block exiting until the user explicitly makes a decision. - if (dialogOverlay.CurrentDialog is PromptForSaveDialog) + if (dialogOverlay.CurrentDialog is PromptForSaveDialog saveDialog) + { + saveDialog.Flash(); return true; + } if (isNewBeatmap || HasUnsavedChanges) {