1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:33:20 +08:00

Fix login panel dropdown forcing user online

It was sort of assuming that the user can't be anything but online when
opening, thus forcing the status to online via the immediately-run value
change callback.
This commit is contained in:
Bartłomiej Dach 2024-01-02 14:07:04 +01:00
parent f9f03ebc0f
commit d4e917448d
No known key found for this signature in database

View File

@ -143,6 +143,8 @@ namespace osu.Game.Overlays.Login
panel.Status.BindTo(api.LocalUser.Value.Status);
panel.Activity.BindTo(api.LocalUser.Value.Activity);
panel.Status.BindValueChanged(_ => updateDropdownCurrent(), true);
dropdown.Current.BindValueChanged(action =>
{
switch (action.NewValue)
@ -174,6 +176,24 @@ namespace osu.Game.Overlays.Login
ScheduleAfterChildren(() => GetContainingInputManager()?.ChangeFocus(form));
});
private void updateDropdownCurrent()
{
switch (panel.Status.Value)
{
case UserStatus.Online:
dropdown.Current.Value = UserAction.Online;
break;
case UserStatus.DoNotDisturb:
dropdown.Current.Value = UserAction.DoNotDisturb;
break;
case UserStatus.Offline:
dropdown.Current.Value = UserAction.AppearOffline;
break;
}
}
public override bool AcceptsFocus => true;
protected override bool OnClick(ClickEvent e) => true;