2021-01-11 14:47:27 +08:00
|
|
|
// 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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2021-01-11 13:44:07 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2022-11-24 15:26:57 +08:00
|
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
2021-01-11 13:44:07 +08:00
|
|
|
using osu.Game.Tournament.IO;
|
|
|
|
|
|
|
|
namespace osu.Game.Tournament.Screens.Setup
|
|
|
|
{
|
|
|
|
internal partial class TournamentSwitcher : ActionableInfo
|
|
|
|
{
|
|
|
|
private OsuDropdown<string> dropdown;
|
2022-02-25 21:16:18 +08:00
|
|
|
private OsuButton folderButton;
|
2021-01-11 13:44:07 +08:00
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private TournamentGameBase game { get; set; }
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(TournamentStorage storage)
|
|
|
|
{
|
2021-01-11 13:45:01 +08:00
|
|
|
string startupTournament = storage.CurrentTournament.Value;
|
2021-01-11 13:44:07 +08:00
|
|
|
|
|
|
|
dropdown.Current = storage.CurrentTournament;
|
|
|
|
dropdown.Items = storage.ListTournaments();
|
|
|
|
dropdown.Current.BindValueChanged(v => Button.Enabled.Value = v.NewValue != startupTournament, true);
|
|
|
|
|
2022-06-19 11:34:14 +08:00
|
|
|
Action = () => game.AttemptExit();
|
2022-03-24 22:40:46 +08:00
|
|
|
folderButton.Action = () => storage.PresentExternally();
|
2021-01-11 13:44:07 +08:00
|
|
|
|
|
|
|
ButtonText = "Close osu!";
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override Drawable CreateComponent()
|
|
|
|
{
|
|
|
|
var drawable = base.CreateComponent();
|
|
|
|
|
2022-11-24 15:26:57 +08:00
|
|
|
FlowContainer.Insert(-1, folderButton = new RoundedButton
|
2021-01-11 13:44:07 +08:00
|
|
|
{
|
2022-02-25 22:13:32 +08:00
|
|
|
Text = "Open folder",
|
|
|
|
Width = 100
|
2021-01-11 13:44:07 +08:00
|
|
|
});
|
|
|
|
|
2022-02-25 22:13:32 +08:00
|
|
|
FlowContainer.Insert(-2, dropdown = new OsuDropdown<string>
|
2022-02-25 21:16:18 +08:00
|
|
|
{
|
2022-02-25 22:13:32 +08:00
|
|
|
Width = 510
|
2022-02-25 21:16:18 +08:00
|
|
|
});
|
|
|
|
|
2021-01-11 13:44:07 +08:00
|
|
|
return drawable;
|
|
|
|
}
|
|
|
|
}
|
2021-01-11 13:45:01 +08:00
|
|
|
}
|