1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

Clean up code

This commit is contained in:
Dean Herbert 2021-01-11 14:35:47 +09:00
parent 49057e8cbc
commit ba3a7a0501

View File

@ -219,33 +219,22 @@ namespace osu.Game.Tournament.Screens
{
private OsuDropdown<string> dropdown;
public IEnumerable<string> Items
{
get => dropdown.Items;
set => dropdown.Items = value;
}
public Bindable<string> Current
{
get => dropdown.Current;
set => dropdown.Current = value;
}
private string originalTournament;
private TournamentStorage storage;
private string startupTournament;
[Resolved]
private TournamentGameBase game { get; set; }
[BackgroundDependencyLoader]
private void load(Storage storage)
private void load(TournamentStorage storage)
{
this.storage = (TournamentStorage)storage;
Current = this.storage.CurrentTournament;
originalTournament = this.storage.CurrentTournament.Value;
Items = this.storage.ListTournaments();
dropdown.Current = storage.CurrentTournament;
dropdown.Items = storage.ListTournaments();
dropdown.Current.BindValueChanged(v => Button.FadeTo(v.NewValue == startupTournament ? 0 : 1));
startupTournament = storage.CurrentTournament.Value;
Action = () => game.GracefullyExit();
ButtonText = "Close osu!";
}
@ -258,17 +247,6 @@ namespace osu.Game.Tournament.Screens
Width = 510
});
Current.BindValueChanged(v =>
{
if (v.NewValue == originalTournament)
{
Button.Hide();
return;
}
Button.Show();
});
return drawable;
}
}