diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index fec1c5ec6e..4ceb8092a1 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -67,6 +67,8 @@ namespace osu.Game.Overlays optionsSection.Bounding = true; FadeIn(transition_time, EasingTypes.OutQuint); + + optionsSection.TriggerFocus(); } protected override void PopOut() diff --git a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs index f95d3a026e..a5e38dd284 100644 --- a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs @@ -11,12 +11,14 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using OpenTK; +using osu.Framework.Input; namespace osu.Game.Overlays.Options.Sections.General { public class LoginOptions : OptionsSubsection, IOnlineComponent { private bool bounding = true; + private LoginForm form; protected override string Header => "Account"; @@ -40,12 +42,14 @@ namespace osu.Game.Overlays.Options.Sections.General public void APIStateChanged(APIAccess api, APIState state) { + form = null; + switch (state) { case APIState.Offline: Children = new Drawable[] { - new LoginForm() + form = new LoginForm() }; break; case APIState.Failing: @@ -82,6 +86,14 @@ namespace osu.Game.Overlays.Options.Sections.General }; break; } + + form?.TriggerFocus(); + } + + protected override bool OnFocus(InputState state) + { + form?.TriggerFocus(); + return base.OnFocus(state); } private class LoginForm : FillFlowContainer @@ -144,6 +156,19 @@ namespace osu.Game.Overlays.Options.Sections.General } }; } + + protected override bool OnFocus(InputState state) + { + Schedule(() => + { + if (string.IsNullOrEmpty(username.Text)) + username.TriggerFocus(); + else + password.TriggerFocus(); + }); + + return base.OnFocus(state); + } } } }