mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 01:43:01 +08: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");
|
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)
|
private void joinFailed(string error)
|
||||||
@ -252,14 +266,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
|||||||
|
|
||||||
sampleJoinFail?.Play();
|
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