diff --git a/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs index b92818b84a..a5a2c5c15f 100644 --- a/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs @@ -10,8 +10,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.UserInterface; -using osu.Game.Input.Bindings; -using osu.Framework.Input.Bindings; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays.Settings; @@ -20,7 +18,7 @@ namespace osu.Game.Tournament.Screens.Editors { - public abstract class TournamentEditorScreen : TournamentScreen, IProvideVideo, IKeyBindingHandler + public abstract class TournamentEditorScreen : TournamentScreen, IProvideVideo where TDrawable : Drawable, IModelBacked where TModel : class, new() { @@ -36,8 +34,6 @@ public abstract class TournamentEditorScreen : TournamentScre private readonly TournamentScreen parentScreen; private BackButton backButton; - private System.Action backAction => () => sceneManager?.SetScreen(parentScreen.GetType()); - protected TournamentEditorScreen(TournamentScreen parentScreen = null) { this.parentScreen = parentScreen; @@ -88,16 +84,12 @@ private void load() if (parentScreen != null) { - AddInternal(backButton = new BackButton(new BackButton.Receptor()) + AddInternal(backButton = new BackButton { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, State = { Value = Visibility.Visible }, - Action = () => - { - if (parentScreen != null) - backAction.Invoke(); - } + Action = () => sceneManager?.SetScreen(parentScreen.GetType()) }); flow.Padding = new MarginPadding { Bottom = backButton.Height * 2 }; @@ -121,22 +113,6 @@ private void load() flow.Add(CreateDrawable(model)); } - public bool OnPressed(GlobalAction action) - { - switch (action) - { - case GlobalAction.Back: - backAction?.Invoke(); - return true; - } - - return false; - } - - public void OnReleased(GlobalAction action) - { - } - protected abstract TDrawable CreateDrawable(TModel model); } } diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index 88ba7ede6e..37a8f7b1b4 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -16,10 +16,8 @@ public class BackButton : VisibilityContainer private readonly TwoLayerButton button; - public BackButton(Receptor receptor) + public BackButton(Receptor receptor = null) { - receptor.OnBackPressed = () => button.Click(); - Size = TwoLayerButton.SIZE_EXTENDED; Child = button = new TwoLayerButton @@ -30,6 +28,10 @@ public BackButton(Receptor receptor) Icon = OsuIcon.LeftCircle, Action = () => Action?.Invoke() }; + + Add(receptor ??= new Receptor()); + + receptor.OnBackPressed = () => button.Click(); } [BackgroundDependencyLoader]