private IEnumerator JoinMatchLobby() { ApplicationModel.JoinToMatchLobby = false; var cancel = false; if (ApplicationModel.CurrentMatchLobbyToJoin.locked) { InvitationCodeModal.InvitationCodeModalResult modalResult = null; yield return(AskForInvitationCode((result) => { modalResult = result; })); cancel = modalResult.OptionSelected != InvitationCodeModal.OptionSelected.OK; if (!cancel) { yield return(StartCoroutine(ConnectMatchLobby(ApplicationModel.CurrentMatchLobbyToJoin.matchLobbyId, invitationCodeModal.Result.InvitationCode))); } } else { yield return(StartCoroutine(ConnectMatchLobby(ApplicationModel.CurrentMatchLobbyToJoin.matchLobbyId))); } if (!cancel && ApplicationModel.CurrentMatchLobby != null) { // HACK: set that the lobby players list has changed in order to trigger the players renderization ApplicationModel.CreateRemotePlayersHandler(PlayFabMultiplayerManager.Get()); ApplicationModel.MatchLobbyJoinedPlayerListHasChanged = true; SceneManager.LoadScene("MatchLobby"); } }
private IEnumerator TryCreateMatchLobby(string sessionName) { var error = Constants.CREATE_MATCH_LOBBY_ERROR; UpdateGameStatus(Constants.MATCH_LOBBY_CREATING + sessionName); try { IsLobbyCreated = true; yield return(StartCoroutine(CreateMatchLobby(sessionName, true))); if (ApplicationModel.CurrentMatchLobby == null) { error = Constants.MATCH_LOBBY_REPEATED; } else { ApplicationModel.CreateRemotePlayersHandler(PlayFabMultiplayerManager.Get()); SceneManager.LoadScene("MatchLobby"); error = string.Empty; } } finally { if (!string.IsNullOrWhiteSpace(error)) { IsLobbyCreated = false; UpdateGameStatus(error); } } }