mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 03:42:57 +08:00
remove #nullable disable, pass action instead of container to DangerousActionDialog
This commit is contained in:
parent
68495c937d
commit
fa480cc27b
@ -1,15 +1,12 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Tournament.Screens.Editors;
|
||||
using osu.Framework.Testing;
|
||||
@ -23,12 +20,13 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
public partial class TestSceneLadderEditorScreen : TournamentTestScene
|
||||
{
|
||||
private LadderEditorScreen ladderEditorScreen;
|
||||
private OsuContextMenuContainer osuContextMenuContainer;
|
||||
private LadderEditorScreen ladderEditorScreen = null!;
|
||||
private OsuContextMenuContainer? osuContextMenuContainer;
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
ladderEditorScreen = new LadderEditorScreen();
|
||||
Add(osuContextMenuContainer = new OsuContextMenuContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -1,24 +1,19 @@
|
||||
// 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 osu.Framework.Graphics.Containers;
|
||||
using System;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using osu.Game.Tournament.Screens.Ladder.Components;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Editors.Components
|
||||
{
|
||||
public partial class LadderResetTeamsDialog : DangerousActionDialog
|
||||
{
|
||||
public LadderResetTeamsDialog(Container<DrawableTournamentMatch> matchesContainer)
|
||||
public LadderResetTeamsDialog(Action action)
|
||||
{
|
||||
HeaderText = @"Confirm reset teams?";
|
||||
HeaderText = @"Reset teams?";
|
||||
Icon = FontAwesome.Solid.Undo;
|
||||
DangerousAction = () =>
|
||||
{
|
||||
foreach (var p in matchesContainer)
|
||||
p.Match.Reset();
|
||||
};
|
||||
DangerousAction = action;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Tournament.Screens.Editors.Components
|
||||
{
|
||||
public TournamentClearAllDialog(IList storage)
|
||||
{
|
||||
HeaderText = @"Confirm clear all?";
|
||||
HeaderText = @"Clear all?";
|
||||
Icon = FontAwesome.Solid.Trash;
|
||||
DangerousAction = storage.Clear;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
|
||||
private WarningBox rightClickMessage;
|
||||
|
||||
[Resolved]
|
||||
[Resolved(canBeNull: true)]
|
||||
[CanBeNull]
|
||||
private IDialogOverlay dialogOverlay { get; set; }
|
||||
|
||||
@ -80,7 +80,11 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
}),
|
||||
new OsuMenuItem("Reset teams", MenuItemType.Destructive, () =>
|
||||
{
|
||||
dialogOverlay?.Push(new LadderResetTeamsDialog(MatchesContainer));
|
||||
dialogOverlay?.Push(new LadderResetTeamsDialog(() =>
|
||||
{
|
||||
foreach (var p in MatchesContainer)
|
||||
p.Match.Reset();
|
||||
}));
|
||||
})
|
||||
};
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
{
|
||||
protected abstract BindableList<TModel> Storage { get; }
|
||||
|
||||
[Resolved]
|
||||
[Resolved(canBeNull: true)]
|
||||
[CanBeNull]
|
||||
private IDialogOverlay dialogOverlay { get; set; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user