mirror of https://github.com/ppy/osu
Centralise join logic
This commit is contained in:
parent
32cbf6e54b
commit
a589964dc7
|
@ -232,7 +232,21 @@ private void load(OsuColour colours, AudioManager audio)
|
|||
|
||||
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 @@ private void joinFailed(string error)
|
|||
|
||||
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