mirror of
https://github.com/ppy/osu.git
synced 2024-09-21 18:47:27 +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.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Logging;
|
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Tournament.Screens.Editors;
|
using osu.Game.Tournament.Screens.Editors;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
@ -23,12 +20,13 @@ namespace osu.Game.Tournament.Tests.Screens
|
|||||||
{
|
{
|
||||||
public partial class TestSceneLadderEditorScreen : TournamentTestScene
|
public partial class TestSceneLadderEditorScreen : TournamentTestScene
|
||||||
{
|
{
|
||||||
private LadderEditorScreen ladderEditorScreen;
|
private LadderEditorScreen ladderEditorScreen = null!;
|
||||||
private OsuContextMenuContainer osuContextMenuContainer;
|
private OsuContextMenuContainer? osuContextMenuContainer;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() => Schedule(() =>
|
public void Setup() => Schedule(() =>
|
||||||
{
|
{
|
||||||
|
ladderEditorScreen = new LadderEditorScreen();
|
||||||
Add(osuContextMenuContainer = new OsuContextMenuContainer
|
Add(osuContextMenuContainer = new OsuContextMenuContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
@ -1,24 +1,19 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// 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.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Overlays.Dialog;
|
using osu.Game.Overlays.Dialog;
|
||||||
using osu.Game.Tournament.Screens.Ladder.Components;
|
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Editors.Components
|
namespace osu.Game.Tournament.Screens.Editors.Components
|
||||||
{
|
{
|
||||||
public partial class LadderResetTeamsDialog : DangerousActionDialog
|
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;
|
Icon = FontAwesome.Solid.Undo;
|
||||||
DangerousAction = () =>
|
DangerousAction = action;
|
||||||
{
|
|
||||||
foreach (var p in matchesContainer)
|
|
||||||
p.Match.Reset();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Tournament.Screens.Editors.Components
|
|||||||
{
|
{
|
||||||
public TournamentClearAllDialog(IList storage)
|
public TournamentClearAllDialog(IList storage)
|
||||||
{
|
{
|
||||||
HeaderText = @"Confirm clear all?";
|
HeaderText = @"Clear all?";
|
||||||
Icon = FontAwesome.Solid.Trash;
|
Icon = FontAwesome.Solid.Trash;
|
||||||
DangerousAction = storage.Clear;
|
DangerousAction = storage.Clear;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
|
|
||||||
private WarningBox rightClickMessage;
|
private WarningBox rightClickMessage;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(canBeNull: true)]
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private IDialogOverlay dialogOverlay { get; set; }
|
private IDialogOverlay dialogOverlay { get; set; }
|
||||||
|
|
||||||
@ -80,7 +80,11 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
}),
|
}),
|
||||||
new OsuMenuItem("Reset teams", MenuItemType.Destructive, () =>
|
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; }
|
protected abstract BindableList<TModel> Storage { get; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(canBeNull: true)]
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private IDialogOverlay dialogOverlay { get; set; }
|
private IDialogOverlay dialogOverlay { get; set; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user