Beispiel #1
0
        /// <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);
                }
            });
        }
        //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);
                }
            }
                                             );
        }
Beispiel #3
0
        //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;
                }
            });
        }
Beispiel #4
0
        /// <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();
                }
            });
        }
Beispiel #5
0
        //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);
                }
            });
        }