// Copyright (c) ppy Pty Ltd . 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 { /// /// A dialog which confirms a user action. /// public class ConfirmDialog : PopupDialog { protected PopupDialogOkButton ButtonConfirm; protected PopupDialogCancelButton ButtonCancel; /// /// Construct a new dialog. /// /// The description of the action to be displayed to the user. /// An action to perform on confirmation. /// An optional action to perform on cancel. public ConfirmDialog(string description, Action onConfirm, Action onCancel = null) { HeaderText = $"Are you sure you want to {description}?"; BodyText = "Last chance to back out."; Icon = FontAwesome.Solid.ExclamationTriangle; Buttons = new PopupDialogButton[] { ButtonConfirm = new PopupDialogOkButton { Text = @"Yes", Action = onConfirm }, ButtonCancel = new PopupDialogCancelButton { Text = @"Cancel", Action = onCancel }, }; } } }