Skip to content

Commit

Permalink
Merge pull request #26381 from Joehuu/flash-ongoing-operations-dialog
Browse files Browse the repository at this point in the history
Flash blocking ongoing operations dialog when trying to force quit
  • Loading branch information
peppy authored Jan 5, 2024
2 parents 35b9940 + b190333 commit fbc40ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -799,11 +799,7 @@ public void TestForceExitWithOperationInProgress()
});
});

AddStep("attempt exit", () =>
{
for (int i = 0; i < 2; ++i)
Game.ScreenStack.CurrentScreen.Exit();
});
AddRepeatStep("attempt force exit", () => Game.ScreenStack.CurrentScreen.Exit(), 2);
AddUntilStep("stopped at exit confirm", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog is ConfirmExitDialog);
}

Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Overlays/Dialog/PopupDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract partial class PopupDialog : VisibilityContainer
private readonly Vector2 ringMinifiedSize = new Vector2(20f);

private readonly Box flashLayer;
private Sample flashSample = null!;
private Sample? flashSample;

private readonly Container content;
private readonly Container ring;
Expand Down Expand Up @@ -267,7 +267,7 @@ public void Flash()
flashLayer.FadeInFromZero(80, Easing.OutQuint)
.Then()
.FadeOutFromOne(1500, Easing.OutQuint);
flashSample.Play();
flashSample?.Play();
}

protected override bool OnKeyDown(KeyDownEvent e)
Expand Down
9 changes: 8 additions & 1 deletion osu.Game/Screens/Menu/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System;
using System.Diagnostics;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Audio;
Expand All @@ -25,6 +26,7 @@
using osu.Game.IO;
using osu.Game.Online.API;
using osu.Game.Overlays;
using osu.Game.Overlays.Dialog;
using osu.Game.Overlays.SkinEditor;
using osu.Game.Rulesets;
using osu.Game.Screens.Backgrounds;
Expand Down Expand Up @@ -390,7 +392,12 @@ public override bool OnExiting(ScreenExitEvent e)
if (requiresConfirmation)
{
if (dialogOverlay.CurrentDialog is ConfirmExitDialog exitDialog)
exitDialog.PerformOkAction();
{
if (exitDialog.Buttons.OfType<PopupDialogOkButton>().FirstOrDefault() != null)
exitDialog.PerformOkAction();
else
exitDialog.Flash();
}
else
{
dialogOverlay.Push(new ConfirmExitDialog(() =>
Expand Down

0 comments on commit fbc40ff

Please sign in to comment.