make ResetConfirmDialog properly utilise its parent's logic

Adjust name of `DeleteAction` to `DangerousAction`
This commit is contained in:
mk56-spn 2023-03-05 20:57:26 +01:00
parent 3bff415909
commit 908651cc11
11 changed files with 13 additions and 28 deletions

View File

@ -13,7 +13,7 @@ namespace osu.Game.Collections
public DeleteCollectionDialog(Live<BeatmapCollection> collection, Action deleteAction) public DeleteCollectionDialog(Live<BeatmapCollection> collection, Action deleteAction)
{ {
BodyText = collection.PerformRead(c => $"{c.Name} ({"beatmap".ToQuantity(c.BeatmapMD5Hashes.Count)})"); BodyText = collection.PerformRead(c => $"{c.Name} ({"beatmap".ToQuantity(c.BeatmapMD5Hashes.Count)})");
DeleteAction = deleteAction; DangerousAction = deleteAction;
} }
} }
} }

View File

@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Dialog
/// <summary> /// <summary>
/// The action which performs the deletion. /// The action which performs the deletion.
/// </summary> /// </summary>
protected Action? DeleteAction { get; set; } protected Action? DangerousAction { get; set; }
protected DangerousActionDialog() protected DangerousActionDialog()
{ {
@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Dialog
new PopupDialogDangerousButton new PopupDialogDangerousButton
{ {
Text = DeleteConfirmationDialogStrings.Confirm, Text = DeleteConfirmationDialogStrings.Confirm,
Action = () => DeleteAction?.Invoke() Action = () => DangerousAction?.Invoke()
}, },
new PopupDialogCancelButton new PopupDialogCancelButton
{ {

View File

@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Mods
public DeleteModPresetDialog(Live<ModPreset> modPreset) public DeleteModPresetDialog(Live<ModPreset> modPreset)
{ {
BodyText = modPreset.PerformRead(preset => preset.Name); BodyText = modPreset.PerformRead(preset => preset.Name);
DeleteAction = () => modPreset.PerformWrite(preset => preset.DeletePending = true); DangerousAction = () => modPreset.PerformWrite(preset => preset.DeletePending = true);
} }
} }
} }

View File

@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
public MassDeleteConfirmationDialog(Action deleteAction) public MassDeleteConfirmationDialog(Action deleteAction)
{ {
BodyText = "Everything?"; BodyText = "Everything?";
DeleteAction = deleteAction; DangerousAction = deleteAction;
} }
} }
} }

View File

@ -12,7 +12,6 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
@ -633,25 +632,11 @@ namespace osu.Game.Overlays.SkinEditor
public partial class ResetConfirmDialog : DangerousActionDialog public partial class ResetConfirmDialog : DangerousActionDialog
{ {
public ResetConfirmDialog(Action reset) public ResetConfirmDialog(Action revert)
{ {
HeaderText = SkinEditorStrings.RevertToDefaultDescription; HeaderText = SkinEditorStrings.RevertToDefaultDescription;
BodyText = SkinEditorStrings.ResetDialogue; BodyText = SkinEditorStrings.ResetDialogue;
DangerousAction = revert;
Icon = FontAwesome.Solid.ExclamationTriangle;
Buttons = new PopupDialogButton[]
{
new PopupDialogDangerousButton
{
Text = BeatmapOverlayStrings.UserContentConfirmButtonText,
Action = reset
},
new PopupDialogCancelButton
{
Text = Web.CommonStrings.ButtonsCancel,
},
};
} }
} }

View File

@ -12,7 +12,7 @@ namespace osu.Game.Screens.Edit
public DeleteDifficultyConfirmationDialog(BeatmapInfo beatmapInfo, Action deleteAction) public DeleteDifficultyConfirmationDialog(BeatmapInfo beatmapInfo, Action deleteAction)
{ {
BodyText = $"\"{beatmapInfo.DifficultyName}\" difficulty"; BodyText = $"\"{beatmapInfo.DifficultyName}\" difficulty";
DeleteAction = deleteAction; DangerousAction = deleteAction;
} }
} }
} }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Screens.Select
public BeatmapClearScoresDialog(BeatmapInfo beatmapInfo, Action onCompletion) public BeatmapClearScoresDialog(BeatmapInfo beatmapInfo, Action onCompletion)
{ {
BodyText = $"All local scores on {beatmapInfo.GetDisplayTitle()}"; BodyText = $"All local scores on {beatmapInfo.GetDisplayTitle()}";
DeleteAction = () => DangerousAction = () =>
{ {
Task.Run(() => scoreManager.Delete(beatmapInfo)) Task.Run(() => scoreManager.Delete(beatmapInfo))
.ContinueWith(_ => onCompletion); .ContinueWith(_ => onCompletion);

View File

@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(BeatmapManager beatmapManager) private void load(BeatmapManager beatmapManager)
{ {
DeleteAction = () => beatmapManager.Delete(beatmapSet); DangerousAction = () => beatmapManager.Delete(beatmapSet);
} }
} }
} }

View File

@ -15,7 +15,7 @@ namespace osu.Game.Screens.Select.Carousel
HeaderText = PopupDialogStrings.UpdateLocallyModifiedText; HeaderText = PopupDialogStrings.UpdateLocallyModifiedText;
BodyText = PopupDialogStrings.UpdateLocallyModifiedDescription; BodyText = PopupDialogStrings.UpdateLocallyModifiedDescription;
Icon = FontAwesome.Solid.ExclamationTriangle; Icon = FontAwesome.Solid.ExclamationTriangle;
DeleteAction = onConfirm; DangerousAction = onConfirm;
} }
} }
} }

View File

@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select
BodyText = $"{score.User} ({score.DisplayAccuracy}, {score.Rank})"; BodyText = $"{score.User} ({score.DisplayAccuracy}, {score.Rank})";
Icon = FontAwesome.Regular.TrashAlt; Icon = FontAwesome.Regular.TrashAlt;
DeleteAction = () => scoreManager.Delete(score); DangerousAction = () => scoreManager.Delete(score);
} }
} }
} }

View File

@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(SkinManager manager) private void load(SkinManager manager)
{ {
DeleteAction = () => DangerousAction = () =>
{ {
manager.Delete(skin.SkinInfo.Value); manager.Delete(skin.SkinInfo.Value);
manager.CurrentSkinInfo.SetDefault(); manager.CurrentSkinInfo.SetDefault();