mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
|
using osu.Framework.Allocation;
|
||
|
using osu.Framework.Graphics;
|
||
|
using osu.Game.Graphics.UserInterface;
|
||
|
using osu.Game.Tournament.IO;
|
||
|
|
||
|
namespace osu.Game.Tournament.Screens.Setup
|
||
|
{
|
||
|
internal class TournamentSwitcher : ActionableInfo
|
||
|
{
|
||
|
private OsuDropdown<string> dropdown;
|
||
|
|
||
|
private string startupTournament;
|
||
|
|
||
|
[Resolved]
|
||
|
private TournamentGameBase game { get; set; }
|
||
|
|
||
|
[BackgroundDependencyLoader]
|
||
|
private void load(TournamentStorage storage)
|
||
|
{
|
||
|
startupTournament = storage.CurrentTournament.Value;
|
||
|
|
||
|
dropdown.Current = storage.CurrentTournament;
|
||
|
dropdown.Items = storage.ListTournaments();
|
||
|
dropdown.Current.BindValueChanged(v => Button.Enabled.Value = v.NewValue != startupTournament, true);
|
||
|
|
||
|
Action = () => game.GracefullyExit();
|
||
|
|
||
|
ButtonText = "Close osu!";
|
||
|
}
|
||
|
|
||
|
protected override Drawable CreateComponent()
|
||
|
{
|
||
|
var drawable = base.CreateComponent();
|
||
|
|
||
|
FlowContainer.Insert(-1, dropdown = new OsuDropdown<string>
|
||
|
{
|
||
|
Width = 510
|
||
|
});
|
||
|
|
||
|
return drawable;
|
||
|
}
|
||
|
}
|
||
|
}
|