2021-03-03 05:50:45 +00:00
|
|
|
// 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;
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Dialog
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// A dialog which confirms a user action.
|
|
|
|
/// </summary>
|
|
|
|
public class ConfirmDialog : PopupDialog
|
|
|
|
{
|
|
|
|
/// <summary>
|
2021-03-03 11:34:36 +00:00
|
|
|
/// Construct a new confirmation dialog.
|
2021-03-03 05:50:45 +00:00
|
|
|
/// </summary>
|
2021-03-03 11:34:36 +00:00
|
|
|
/// <param name="message">The description of the action to be displayed to the user.</param>
|
2021-03-03 05:50:45 +00:00
|
|
|
/// <param name="onConfirm">An action to perform on confirmation.</param>
|
|
|
|
/// <param name="onCancel">An optional action to perform on cancel.</param>
|
2021-03-03 11:34:36 +00:00
|
|
|
public ConfirmDialog(string message, Action onConfirm, Action onCancel = null)
|
2021-03-03 05:50:45 +00:00
|
|
|
{
|
2021-03-03 11:34:36 +00:00
|
|
|
HeaderText = message;
|
|
|
|
BodyText = "Last chance to turn back";
|
2021-03-03 05:50:45 +00:00
|
|
|
|
|
|
|
Icon = FontAwesome.Solid.ExclamationTriangle;
|
|
|
|
|
|
|
|
Buttons = new PopupDialogButton[]
|
|
|
|
{
|
2021-03-03 11:34:36 +00:00
|
|
|
new PopupDialogOkButton
|
2021-03-03 05:50:45 +00:00
|
|
|
{
|
|
|
|
Text = @"Yes",
|
|
|
|
Action = onConfirm
|
|
|
|
},
|
2021-03-03 11:34:36 +00:00
|
|
|
new PopupDialogCancelButton
|
2021-03-03 05:50:45 +00:00
|
|
|
{
|
2021-04-20 08:06:26 +00:00
|
|
|
Text = Localisation.CommonStrings.Cancel,
|
2021-03-03 05:50:45 +00:00
|
|
|
Action = onCancel
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|