// 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; using osu.Game.Localisation; namespace osu.Game.Overlays.Dialog { /// /// A dialog which provides confirmation for actions which result in permanent consequences. /// Differs from in that the confirmation button is a "dangerous" one /// (requires the confirm button to be held). /// /// /// The default implementation comes with text for a generic deletion operation. /// This can be further customised by specifying custom . /// public abstract partial class DangerousActionDialog : PopupDialog { /// /// The action which performs the deletion. /// protected Action? DangerousAction { get; set; } /// /// The action to perform if cancelled. /// protected Action? CancelAction { get; set; } protected DangerousActionDialog() { HeaderText = DialogStrings.CautionHeaderText; Icon = FontAwesome.Solid.ExclamationTriangle; Buttons = new PopupDialogButton[] { new PopupDialogDangerousButton { Text = DialogStrings.Confirm, Action = () => DangerousAction?.Invoke() }, new PopupDialogCancelButton { Text = DialogStrings.Cancel, Action = () => CancelAction?.Invoke() } }; } } }