/// <summary> /// Populates game settings for broadcast to clients and attempts to start matchmaking server session. /// </summary> private void StartMatchmakingGame() { GameSettings settings = GameSettings.s_Instance; settings.SetMapIndex(m_MapSelect.currentIndex); settings.SetModeIndex(m_ModeSelect.currentIndex); m_MenuUi.ShowConnectingModal(false); Debug.Log(GetGameName()); m_NetManager.StartMatchmakingGame(GetGameName(), (success, matchInfo) => { if (!success) { m_MenuUi.ShowInfoPopup("Failed to create game.", null); } else { m_MenuUi.HideInfoPopup(); m_MenuUi.ShowLobbyPanel(); // Agora.io Implimentation var channelName = m_MatchNameInput.text; // testing --> prod use: m_MatchNameInput.text IRtcEngine mRtcEngine = IRtcEngine.GetEngine(AgoraInterface.appId); // Get a reference to the Engine mRtcEngine.JoinChannel(channelName, "extra", 0); // join the channel with given match name // testing string joinChannelMessage = string.Format("joining channel: {0}", channelName); Debug.Log(joinChannelMessage); } }); }
/// <summary> /// Populates game settings for broadcast to clients and attempts to start matchmaking server session. /// </summary> private void StartMatchmakingGame() { GameSettings settings = GameSettings.s_Instance; settings.SetMapIndex(m_MapSelect.currentIndex); settings.SetModeIndex(m_ModeSelect.currentIndex); m_MenuUi.ShowConnectingModal(false); Debug.Log(GetGameName()); m_NetManager.StartMatchmakingGame(GetGameName(), (success, matchInfo) => { if (!success) { m_MenuUi.ShowInfoPopup("Failed to create game.", null); } else { m_MenuUi.HideInfoPopup(); m_MenuUi.ShowLobbyPanel(); } }); }