mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +08:00
Use DangerousActionDialog
This commit is contained in:
parent
8587652869
commit
f317e06da1
@ -23,6 +23,11 @@ namespace osu.Game.Overlays.Dialog
|
||||
/// </summary>
|
||||
protected Action? DangerousAction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The action to perform if cancelled.
|
||||
/// </summary>
|
||||
protected Action? CancelAction { get; set; }
|
||||
|
||||
protected DangerousActionDialog()
|
||||
{
|
||||
HeaderText = DeleteConfirmationDialogStrings.HeaderText;
|
||||
@ -38,7 +43,8 @@ namespace osu.Game.Overlays.Dialog
|
||||
},
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = DeleteConfirmationDialogStrings.Cancel
|
||||
Text = DeleteConfirmationDialogStrings.Cancel,
|
||||
Action = () => CancelAction?.Invoke()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,33 +1,15 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
{
|
||||
public partial class ConfirmAbortDialog : PopupDialog
|
||||
public partial class ConfirmAbortDialog : DangerousActionDialog
|
||||
{
|
||||
public ConfirmAbortDialog(Action onConfirm, Action onCancel)
|
||||
public ConfirmAbortDialog()
|
||||
{
|
||||
HeaderText = "Are you sure you want to abort the match?";
|
||||
|
||||
Icon = FontAwesome.Solid.ExclamationTriangle;
|
||||
|
||||
Buttons = new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogDangerousButton
|
||||
{
|
||||
Text = @"Yes",
|
||||
Action = onConfirm
|
||||
},
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = @"No I didn't mean to",
|
||||
Action = onCancel
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ using osu.Framework.Threading;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer.Countdown;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
@ -247,5 +248,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
countReady = newCountReady;
|
||||
});
|
||||
}
|
||||
|
||||
public partial class ConfirmAbortDialog : DangerousActionDialog
|
||||
{
|
||||
public ConfirmAbortDialog(Action abortMatch, Action cancel)
|
||||
{
|
||||
HeaderText = "Are you sure you want to abort the match?";
|
||||
|
||||
DangerousAction = abortMatch;
|
||||
CancelAction = cancel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user