Update focus handling in line with framework changes

This commit is contained in:
Dean Herbert
2017-05-28 20:08:46 +09:00
parent bdeaf2dbb4
commit d749fc516d
8 changed files with 42 additions and 18 deletions

View File

@ -51,9 +51,12 @@ namespace osu.Game.Overlays.Settings.Sections.General
Spacing = new Vector2(0f, 5f);
}
private InputManager inputManager;
[BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, APIAccess api)
private void load(OsuColour colours, APIAccess api, UserInputManager inputManager)
{
this.inputManager = inputManager;
this.colours = colours;
api?.Register(this);
}
@ -160,12 +163,12 @@ namespace osu.Game.Overlays.Settings.Sections.General
break;
}
form?.TriggerFocus();
if (form != null) inputManager.ChangeFocus(form);
}
protected override bool OnFocus(InputState state)
{
form?.TriggerFocus();
if (form != null) inputManager.ChangeFocus(form);
return base.OnFocus(state);
}
@ -174,6 +177,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
private TextBox username;
private TextBox password;
private APIAccess api;
private InputManager inputManager;
private void performLogin()
{
@ -182,8 +186,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
}
[BackgroundDependencyLoader(permitNulls: true)]
private void load(APIAccess api, OsuConfigManager config)
private void load(APIAccess api, OsuConfigManager config, UserInputManager inputManager)
{
this.inputManager = inputManager;
this.api = api;
Direction = FillDirection.Vertical;
Spacing = new Vector2(0, 5);
@ -235,9 +240,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
Schedule(() =>
{
if (string.IsNullOrEmpty(username.Text))
username.TriggerFocus();
inputManager.ChangeFocus(username);
else
password.TriggerFocus();
inputManager.ChangeFocus(password);
});
return base.OnFocus(state);