예제 #1
0
        /// <summary>
        /// Populates game settings for broadcast to clients and attempts to start matchmaking server session.
        /// </summary>
        private void StartMatchmakingGame()
        {
            //_menuUi.ShowConnectingModal(false);

            Debug.Log(GetGameName());
            _netManager.StartMatchmakingGame(GetGameName(), (success, matchInfo) =>
            {
                if (!success)
                {
                    _menuUi.ShowInfoPopup("Failed to create game.", null);
                }
                else
                {
                    _menuUi.HideInfoPopup();
                    _menuUi.ShowLobbyPanel();
                }
            });
        }
예제 #2
0
        //Fired when player clicks join
        private void JoinMatch(NetworkID networkId)
        {
            MainMenuUI menuUi = MainMenuUI.Instance;

            //menuUi.ShowConnectingModal(true);

            _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...");
                    _netManager.gameModeUpdated += menuUi.ShowLobbyPanelForConnection;
                }
            });
        }