//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);
                }
            }
                                             );
        }
示例#2
0
        /// <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();
        }
示例#3
0
        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();
            }
        }
示例#4
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;
                }
            });
        }
示例#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);
                }
            });
        }
示例#6
0
        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();
            }
        }
示例#7
0
        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();
            }
        }