Move almost all state change tracking to MultiplayerState
Each window can still watch for state changes to update the ui or to close the window as appropriate, but for any error announcements, they all belong in Multiplayer state now.
This commit is contained in:
parent
a5c8e07f46
commit
1f6791431d
7 changed files with 55 additions and 88 deletions
|
@ -105,20 +105,8 @@ void DirectConnectWindow::EndConnecting() {
|
|||
void DirectConnectWindow::OnConnection() {
|
||||
EndConnecting();
|
||||
|
||||
bool isConnected = true;
|
||||
if (auto room_member = Network::GetRoomMember().lock()) {
|
||||
switch (room_member->GetState()) {
|
||||
case Network::RoomMember::State::CouldNotConnect:
|
||||
isConnected = false;
|
||||
ShowError(NetworkMessage::UNABLE_TO_CONNECT);
|
||||
break;
|
||||
case Network::RoomMember::State::NameCollision:
|
||||
isConnected = false;
|
||||
ShowError(NetworkMessage::USERNAME_IN_USE);
|
||||
break;
|
||||
case Network::RoomMember::State::Joining:
|
||||
auto parent = static_cast<MultiplayerState*>(parentWidget());
|
||||
parent->OnOpenNetworkRoom();
|
||||
if (room_member->GetState() == Network::RoomMember::State::Joined) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue