mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 05:22:54 +08:00
add confirmation dialog for Clear All button in TournamentEditorScreen
This commit is contained in:
parent
41638ff4b7
commit
e3a7b6969a
@ -1,13 +1,15 @@
|
|||||||
// 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.Allocation;
|
||||||
using osu.Game.Tournament.Screens.Editors;
|
using osu.Game.Tournament.Screens.Editors;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Screens
|
namespace osu.Game.Tournament.Tests.Screens
|
||||||
{
|
{
|
||||||
public partial class TestSceneRoundEditorScreen : TournamentTestScene
|
public partial class TestSceneRoundEditorScreen : TournamentTestScene
|
||||||
{
|
{
|
||||||
public TestSceneRoundEditorScreen()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
{
|
{
|
||||||
Add(new RoundEditorScreen
|
Add(new RoundEditorScreen
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,8 @@ namespace osu.Game.Tournament.Tests.Screens
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly LadderInfo ladder = new LadderInfo();
|
private readonly LadderInfo ladder = new LadderInfo();
|
||||||
|
|
||||||
public TestSceneSeedingEditorScreen()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
{
|
{
|
||||||
var match = CreateSampleMatch();
|
var match = CreateSampleMatch();
|
||||||
|
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
// 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.Allocation;
|
||||||
using osu.Game.Tournament.Screens.Editors;
|
using osu.Game.Tournament.Screens.Editors;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Screens
|
namespace osu.Game.Tournament.Tests.Screens
|
||||||
{
|
{
|
||||||
public partial class TestSceneTeamEditorScreen : TournamentTestScene
|
public partial class TestSceneTeamEditorScreen : TournamentTestScene
|
||||||
{
|
{
|
||||||
public TestSceneTeamEditorScreen()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
{
|
{
|
||||||
Add(new TeamEditorScreen
|
Add(new TeamEditorScreen
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
// 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 System.Collections;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Overlays.Dialog;
|
||||||
|
|
||||||
|
namespace osu.Game.Tournament.Screens.Editors.Components
|
||||||
|
{
|
||||||
|
public partial class TournamentClearAllDialog : DangerousActionDialog
|
||||||
|
|
||||||
|
{
|
||||||
|
public TournamentClearAllDialog(IList storage)
|
||||||
|
{
|
||||||
|
HeaderText = @"Confirm clear all?";
|
||||||
|
Icon = FontAwesome.Solid.Trash;
|
||||||
|
DangerousAction = storage.Clear;
|
||||||
|
}
|
||||||
|
|
||||||
|
// // 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 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)
|
||||||
|
// {
|
||||||
|
// HeaderText = @"Confirm reset teams?";
|
||||||
|
// Icon = FontAwesome.Solid.Undo;
|
||||||
|
// DangerousAction = () =>
|
||||||
|
// {
|
||||||
|
// foreach (var p in matchesContainer)
|
||||||
|
// p.Match.Reset();
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -7,13 +7,17 @@ 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.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Logging;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
|
using osu.Game.Tournament.Screens.Editors.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Editors
|
namespace osu.Game.Tournament.Screens.Editors
|
||||||
@ -21,6 +25,38 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
public partial class RoundEditorScreen : TournamentEditorScreen<RoundEditorScreen.RoundRow, TournamentRound>
|
public partial class RoundEditorScreen : TournamentEditorScreen<RoundEditorScreen.RoundRow, TournamentRound>
|
||||||
{
|
{
|
||||||
protected override BindableList<TournamentRound> Storage => LadderInfo.Rounds;
|
protected override BindableList<TournamentRound> Storage => LadderInfo.Rounds;
|
||||||
|
//
|
||||||
|
// [Resolved]
|
||||||
|
// private IDialogOverlay? dialogOverlay { get; set; }
|
||||||
|
//
|
||||||
|
// [BackgroundDependencyLoader]
|
||||||
|
// private void load()
|
||||||
|
// {
|
||||||
|
// // ControlPanel.Add(new TourneyButton
|
||||||
|
// // {
|
||||||
|
// // RelativeSizeAxes = Axes.X,
|
||||||
|
// // Text = "aaaaaa",
|
||||||
|
// // Action = () =>
|
||||||
|
// // {
|
||||||
|
// // Logger.Log("asdaf", LoggingTarget.Runtime, LogLevel.Important);
|
||||||
|
// // }
|
||||||
|
// // });
|
||||||
|
// // Logger.Log($"Current action is {.Action}", LoggingTarget.Runtime, LogLevel.Important);
|
||||||
|
//
|
||||||
|
// dialogOverlay?.Push(new TournamentClearAllDialog(Storage));
|
||||||
|
//
|
||||||
|
// var clearAllButton = ControlPanel.ChildrenOfType<DangerousSettingsButton>().FirstOrDefault();
|
||||||
|
//
|
||||||
|
// if (clearAllButton != null)
|
||||||
|
// {
|
||||||
|
// clearAllButton.Action = () =>
|
||||||
|
// {
|
||||||
|
// Logger.Log("doing the thing!", LoggingTarget.Runtime, LogLevel.Important);
|
||||||
|
// Logger.Log($"currently, dialogOverlay is {dialogOverlay}", LoggingTarget.Runtime, LogLevel.Important);
|
||||||
|
// dialogOverlay?.Push(new TournamentClearAllDialog(Storage));
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
public partial class RoundRow : CompositeDrawable, IModelBacked<TournamentRound>
|
public partial class RoundRow : CompositeDrawable, IModelBacked<TournamentRound>
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
@ -15,8 +16,10 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
|
using osu.Game.Tournament.Screens.Editors.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Editors
|
namespace osu.Game.Tournament.Screens.Editors
|
||||||
@ -27,6 +30,10 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
{
|
{
|
||||||
protected abstract BindableList<TModel> Storage { get; }
|
protected abstract BindableList<TModel> Storage { get; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
[CanBeNull]
|
||||||
|
private IDialogOverlay dialogOverlay { get; set; }
|
||||||
|
|
||||||
private FillFlowContainer<TDrawable> flow;
|
private FillFlowContainer<TDrawable> flow;
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
@ -79,7 +86,10 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Text = "Clear all",
|
Text = "Clear all",
|
||||||
Action = Storage.Clear
|
Action = () =>
|
||||||
|
{
|
||||||
|
dialogOverlay?.Push(new TournamentClearAllDialog(Storage));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user