[ADD] added joining lobbies
This commit is contained in:
@@ -34,7 +34,7 @@ namespace Client
|
||||
|
||||
OnHostButtonClick = new RelayCommand(hostGame);
|
||||
|
||||
JoinSelectedLobby = new RelayCommand(startGameInLobby, true);
|
||||
JoinSelectedLobby = new RelayCommand(joinLobby, true);
|
||||
}
|
||||
|
||||
private void hostGame()
|
||||
@@ -57,6 +57,17 @@ namespace Client
|
||||
});
|
||||
}
|
||||
|
||||
private void joinLobby()
|
||||
{
|
||||
client.OnLobbyJoinSuccess = OnLobbyJoinSuccess;
|
||||
client.SendMessage(JSONConvert.ConstructLobbyJoinMessage(SelectedLobby.ID));
|
||||
}
|
||||
|
||||
private void OnLobbyJoinSuccess()
|
||||
{
|
||||
startGameInLobby();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void updateLobbies()
|
||||
@@ -85,8 +96,11 @@ namespace Client
|
||||
private void startGameWindow()
|
||||
{
|
||||
_model.CanStartGame = false;
|
||||
GameWindow window = new GameWindow();
|
||||
window.Show();
|
||||
Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
GameWindow window = new GameWindow();
|
||||
window.Show();
|
||||
});
|
||||
}
|
||||
|
||||
private void ClickCheck()
|
||||
|
||||
Reference in New Issue
Block a user