mirror of https://github.com/ppy/osu
Clean up code
This commit is contained in:
parent
49057e8cbc
commit
ba3a7a0501
|
@ -219,33 +219,22 @@ private class TournamentSwitcher : ActionableInfo
|
|||
{
|
||||
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 @@ protected override Drawable CreateComponent()
|
|||
Width = 510
|
||||
});
|
||||
|
||||
Current.BindValueChanged(v =>
|
||||
{
|
||||
if (v.NewValue == originalTournament)
|
||||
{
|
||||
Button.Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
Button.Show();
|
||||
});
|
||||
|
||||
return drawable;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue