mirror of
https://github.com/ppy/osu
synced 2025-01-18 03:50:57 +00:00
Centralise join logic
This commit is contained in:
parent
32cbf6e54b
commit
a589964dc7
@ -232,7 +232,21 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
|
||||
sampleJoinFail = audio.Samples.Get(@"UI/password-fail");
|
||||
|
||||
joinButton.Action = () => lounge?.Join(room, passwordTextbox.Text, null, joinFailed);
|
||||
joinButton.Action = performJoin;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Schedule(() => GetContainingInputManager().ChangeFocus(passwordTextbox));
|
||||
passwordTextbox.OnCommit += (_, __) => performJoin();
|
||||
}
|
||||
|
||||
private void performJoin()
|
||||
{
|
||||
lounge?.Join(room, passwordTextbox.Text, null, joinFailed);
|
||||
GetContainingInputManager().TriggerFocusContention(passwordTextbox);
|
||||
}
|
||||
|
||||
private void joinFailed(string error)
|
||||
@ -252,14 +266,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
|
||||
sampleJoinFail?.Play();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Schedule(() => GetContainingInputManager().ChangeFocus(passwordTextbox));
|
||||
passwordTextbox.OnCommit += (_, __) => lounge?.Join(room, passwordTextbox.Text, null, joinFailed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user