1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00
Dean Herbert 2024-03-29 12:03:05 +08:00
parent c51a2e169d
commit fef8afb833
No known key found for this signature in database

View File

@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Login
[Resolved]
private OsuColour colours { get; set; } = null!;
private UserDropdown dropdown = null!;
private UserDropdown? dropdown;
/// <summary>
/// Called to request a hide of a parent displaying this container.
@ -68,6 +68,14 @@ namespace osu.Game.Overlays.Login
apiState.BindValueChanged(onlineStateChanged, true);
}
protected override void LoadComplete()
{
base.LoadComplete();
userStatus.BindTo(api.LocalUser.Value.Status);
userStatus.BindValueChanged(e => updateDropdownCurrent(e.NewValue), true);
}
private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() =>
{
form = null;
@ -144,9 +152,6 @@ namespace osu.Game.Overlays.Login
},
};
userStatus.BindTo(api.LocalUser.Value.Status);
userStatus.BindValueChanged(e => updateDropdownCurrent(e.NewValue), true);
dropdown.Current.BindValueChanged(action =>
{
switch (action.NewValue)
@ -171,6 +176,7 @@ namespace osu.Game.Overlays.Login
break;
}
}, true);
break;
}
@ -180,6 +186,9 @@ namespace osu.Game.Overlays.Login
private void updateDropdownCurrent(UserStatus? status)
{
if (dropdown == null)
return;
switch (status)
{
case UserStatus.Online: