From 864c1a73ae0ac1a1217ea85d8977004d171ff8bf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 17 May 2020 17:27:52 +0900 Subject: [PATCH] Only add back button if required --- .../Screens/Editors/TournamentEditorScreen.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs index 7043328aa7..b92818b84a 100644 --- a/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TournamentEditorScreen.cs @@ -46,18 +46,6 @@ namespace osu.Game.Tournament.Screens.Editors [BackgroundDependencyLoader] private void load() { - BackButton.Receptor receptor = new BackButton.Receptor(); - backButton = new BackButton(receptor) - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Action = () => - { - if (parentScreen != null) - backAction.Invoke(); - } - }; - AddRangeInternal(new Drawable[] { new Box @@ -76,10 +64,8 @@ namespace osu.Game.Tournament.Screens.Editors RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(20), - Padding = new MarginPadding { Bottom = backButton.Height * 2 }, }, }, - backButton, ControlPanel = new ControlPanel { Children = new Drawable[] @@ -101,7 +87,21 @@ namespace osu.Game.Tournament.Screens.Editors }); if (parentScreen != null) - backButton.Show(); + { + AddInternal(backButton = new BackButton(new BackButton.Receptor()) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + State = { Value = Visibility.Visible }, + Action = () => + { + if (parentScreen != null) + backAction.Invoke(); + } + }); + + flow.Padding = new MarginPadding { Bottom = backButton.Height * 2 }; + } Storage.CollectionChanged += (_, args) => { @@ -126,7 +126,7 @@ namespace osu.Game.Tournament.Screens.Editors switch (action) { case GlobalAction.Back: - backAction.Invoke(); + backAction?.Invoke(); return true; }