1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 07:43:00 +08:00

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

View File

@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Mods
public DeleteModPresetDialog(Live<ModPreset> modPreset)
{
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)
{
BodyText = "Everything?";
DeleteAction = deleteAction;
DangerousAction = deleteAction;
}
}
}

View File

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

View File

@ -12,7 +12,7 @@ namespace osu.Game.Screens.Edit
public DeleteDifficultyConfirmationDialog(BeatmapInfo beatmapInfo, Action deleteAction)
{
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)
{
BodyText = $"All local scores on {beatmapInfo.GetDisplayTitle()}";
DeleteAction = () =>
DangerousAction = () =>
{
Task.Run(() => scoreManager.Delete(beatmapInfo))
.ContinueWith(_ => onCompletion);

View File

@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select
[BackgroundDependencyLoader]
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;
BodyText = PopupDialogStrings.UpdateLocallyModifiedDescription;
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})";
Icon = FontAwesome.Regular.TrashAlt;
DeleteAction = () => scoreManager.Delete(score);
DangerousAction = () => scoreManager.Delete(score);
}
}
}

View File

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