mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Show a notification instead of blocking exit of wizard
This commit is contained in:
@ -10,7 +10,6 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Dialog;
|
|
||||||
using osu.Game.Overlays.FirstRunSetup;
|
using osu.Game.Overlays.FirstRunSetup;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -23,19 +22,14 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
private FirstRunSetupOverlay overlay;
|
private FirstRunSetupOverlay overlay;
|
||||||
|
|
||||||
private readonly Mock<IPerformFromScreenRunner> perfomer = new Mock<IPerformFromScreenRunner>();
|
private readonly Mock<IPerformFromScreenRunner> perfomer = new Mock<IPerformFromScreenRunner>();
|
||||||
private readonly Mock<IDialogOverlay> dialogOverlay = new Mock<IDialogOverlay>();
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Dependencies.CacheAs(perfomer.Object);
|
Dependencies.CacheAs(perfomer.Object);
|
||||||
Dependencies.CacheAs(dialogOverlay.Object);
|
|
||||||
|
|
||||||
perfomer.Setup(g => g.PerformFromScreen(It.IsAny<Action<IScreen>>(), It.IsAny<IEnumerable<Type>>()))
|
perfomer.Setup(g => g.PerformFromScreen(It.IsAny<Action<IScreen>>(), It.IsAny<IEnumerable<Type>>()))
|
||||||
.Callback((Action<IScreen> action, IEnumerable<Type> types) => action(null));
|
.Callback((Action<IScreen> action, IEnumerable<Type> types) => action(null));
|
||||||
|
|
||||||
dialogOverlay.Setup(d => d.Push(It.IsAny<PopupDialog>()))
|
|
||||||
.Callback((PopupDialog dialog) => dialog.PerformOkAction());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
|
@ -222,13 +222,6 @@ namespace osu.Game.Overlays
|
|||||||
performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) });
|
performer.PerformFromScreen(_ => { Show(); }, new[] { typeof(MainMenu) });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
|
||||||
{
|
|
||||||
dialogOverlay.Push(new ConfirmDialog("Are you sure you want to exit the setup process?", Hide, () => { }));
|
|
||||||
|
|
||||||
return base.OnClick(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
base.PopIn();
|
base.PopIn();
|
||||||
@ -283,6 +276,20 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
|
if (currentStepIndex != null)
|
||||||
|
{
|
||||||
|
notificationOverlay?.Post(new SimpleNotification
|
||||||
|
{
|
||||||
|
Text = "Click here to resume initial setup at any point",
|
||||||
|
Icon = FontAwesome.Solid.Horse,
|
||||||
|
Activated = () =>
|
||||||
|
{
|
||||||
|
Show();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
base.PopOut();
|
base.PopOut();
|
||||||
this.FadeOut(100);
|
this.FadeOut(100);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user