//Fired when player clicks join private void JoinMatch(NetworkID networkId, String matchName) { MainMenuUI menuUi = MainMenuUI.s_Instance; menuUi.ShowConnectingModal(true); m_NetManager.JoinMatchmakingGame(networkId, (success, matchInfo) => { //Failure flow if (!success) { menuUi.ShowInfoPopup("Failed to join game.", null); } //Success flow else { menuUi.HideInfoPopup(); menuUi.ShowInfoPopup("Entering lobby..."); m_NetManager.gameModeUpdated += menuUi.ShowLobbyPanelForConnection; // Agora.io Implimentation var channelName = matchName; // testing --> prod use: matchName 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> /// Create button method. Validates entered server name and launches game server. /// </summary> public void OnCreateClicked() { if (string.IsNullOrEmpty(m_MatchNameInput.text)) { m_MenuUi.ShowInfoPopup("Server name cannot be empty!", null); return; } StartMatchmakingGame(); }
protected virtual void OnError(UnityEngine.Networking.NetworkConnection conn, int errorCode) { if (m_MenuUi != null) { m_MenuUi.ShowDefaultPanel(); m_MenuUi.ShowInfoPopup("A connection error occurred", null); } if (m_NetManager != null) { m_NetManager.Disconnect(); } }
//Fired when player clicks join private void JoinMatch(NetworkID networkId) { MainMenuUI menuUi = MainMenuUI.s_Instance; menuUi.ShowConnectingModal(true); m_NetManager.JoinMatchmakingGame(networkId, (success, matchInfo) => { if (!success) { menuUi.ShowInfoPopup("Failed to join game.", null); } else { menuUi.HideInfoPopup(); menuUi.ShowInfoPopup("Entering lobby..."); m_NetManager.gameModeUpdated += menuUi.ShowLobbyPanelForConnection; } }); }
//Fired when player clicks join private void JoinMatch(NetworkID networkId, string channelName) { MainMenuUI menuUi = MainMenuUI.s_Instance; menuUi.ShowConnectingModal(true); m_NetManager.JoinMatchmakingGame(networkId, (success, matchInfo) => { //Failure flow if (!success) { menuUi.ShowInfoPopup("Failed to join game.", null); } //Success flow else { menuUi.HideInfoPopup(); menuUi.ShowInfoPopup("Entering lobby..."); m_NetManager.gameModeUpdated += menuUi.ShowLobbyPanelForConnection; AgoraVideoController.instance.JoinChannel(channelName); } }); }
protected virtual void OnDrop() { MainMenuUI menuUi = MainMenuUI.s_Instance; if (menuUi != null) { menuUi.ShowDefaultPanel(); menuUi.ShowInfoPopup("Disconnected from server", null); } if (m_NetManager != null) { m_NetManager.Disconnect(); } }
protected virtual void OnError(NetworkConnection conn, int errorCode) { MainMenuUI menuUi = MainMenuUI.s_Instance; if (menuUi != null) { menuUi.ShowDefaultPanel(); menuUi.ShowInfoPopup("A connection error occurred", null); } if (m_NetManager != null) { m_NetManager.Disconnect(); } }