diff --git a/osu.Game.Tournament/Screens/SetupScreen.cs b/osu.Game.Tournament/Screens/SetupScreen.cs index 3c9d3c949b..de3321397e 100644 --- a/osu.Game.Tournament/Screens/SetupScreen.cs +++ b/osu.Game.Tournament/Screens/SetupScreen.cs @@ -42,6 +42,9 @@ namespace osu.Game.Tournament.Screens [Resolved] private RulesetStore rulesets { get; set; } + [Resolved] + private TournamentGameBase game { get; set; } + [Resolved(canBeNull: true)] private TournamentSceneManager sceneManager { get; set; } @@ -68,9 +71,6 @@ namespace osu.Game.Tournament.Screens reload(); } - [Resolved] - private Framework.Game game { get; set; } - private void reload() { var fileBasedIpc = ipc as FileBasedIPC; @@ -115,12 +115,14 @@ namespace osu.Game.Tournament.Screens Items = rulesets.AvailableRulesets, Current = LadderInfo.Ruleset, }, - new LabelledDropdown + new TournamentSwitcher { Label = "Current tournament", Description = "Changes the background videos and bracket to match the selected tournament. This requires a restart to apply changes.", Items = storage.ListTournaments(), Current = storage.CurrentTournament, + ButtonText = "Close osu!", + Action = () => game.GracefullyExit() }, resolution = new ResolutionSelector { @@ -165,7 +167,7 @@ namespace osu.Game.Tournament.Screens private class ActionableInfo : LabelledDrawable { - private OsuButton button; + protected OsuButton Button; public ActionableInfo() : base(true) @@ -174,7 +176,7 @@ namespace osu.Game.Tournament.Screens public string ButtonText { - set => button.Text = value; + set => Button.Text = value; } public string Value @@ -211,7 +213,7 @@ namespace osu.Game.Tournament.Screens Spacing = new Vector2(10, 0), Children = new Drawable[] { - button = new TriangleButton + Button = new TriangleButton { Size = new Vector2(100, 40), Action = () => Action?.Invoke() @@ -222,6 +224,34 @@ namespace osu.Game.Tournament.Screens }; } + private class TournamentSwitcher : ActionableInfo + { + private OsuDropdown dropdown; + + public IEnumerable Items + { + get => dropdown.Items; + set => dropdown.Items = value; + } + + public Bindable Current + { + get => dropdown.Current; + set => dropdown.Current = value; + } + + protected override Drawable CreateComponent() + { + var drawable = base.CreateComponent(); + FlowContainer.Insert(-1, dropdown = new OsuDropdown + { + Width = 510 + }); + + return drawable; + } + } + private class ResolutionSelector : ActionableInfo { private const int minimum_window_height = 480;