Пример #1
0
        /// <summary>
        /// Makes the server change to the menu scene, and bring all clients with it
        /// </summary>
        public void ReturnToMenu(MenuPage returnPage)
        {
            MainMenuUI.s_ReturnPage = returnPage;

            // Update will change scenes once loading screen is visible
            m_SceneChangeMode = SceneChangeMode.Menu;

            if (s_IsServer && state == NetworkState.InGame)
            {
                // Clear all client's ready states
                ClearAllReadyStates();

                // Tell NetworkPlayers to show their loading screens
                for (int i = 0; i < connectedPlayers.Count; ++i)
                {
                    NetworkPlayer player = connectedPlayers[i];
                    if (player != null)
                    {
                        player.RpcPrepareForLoad();
                    }
                }
            }
            else
            {
                // Show loading screen
                LoadingModal loading = LoadingModal.s_Instance;

                if (loading != null)
                {
                    loading.FadeIn();
                }
            }
        }
Пример #2
0
        public void ReturnToMenu(MenuPage returnPage)
        {
            s_ReturnPage = returnPage;

            m_SceneChangeMode = SceneChangeMode.Menu;
            Debug.Log(m_SceneChangeMode);

            if (s_IsServer && state == GameState.InGame)
            {
                for (int i = 0; i < lobbySlots.Length; ++i)
                {
                    if (lobbySlots[i] != null)
                    {
                        (lobbySlots[i] as LobbyPlayer).RpcUpdateCountdown();
                    }
                }
            }

            else
            {
                LoadingModal loading = LoadingModal.s_Instance;

                if (loading != null)
                {
                    loading.FadeOut();
                }
            }
        }
Пример #3
0
 void Update()
 {
     if (m_SceneChangeMode != SceneChangeMode.None)
     {
         if (m_SceneChangeMode == SceneChangeMode.Menu)
         {
             if (state != GameState.Inactive)
             {
                 ServerChangeScene(lobbyScene);
             }
             else
             {
                 ShowDefaultPanel();
             }
         }
         else
         {
             //LoadingModal modal = LoadingModal.s_Instance;
             //if (modal != null)
             //{
             //	modal.FadeOut();
             //}
         }
         m_SceneChangeMode = SceneChangeMode.None;
     }
 }
Пример #4
0
        // --- Countdown management

        public override void OnLobbyServerPlayersReady()
        {
            bool allready = true;

            for (int i = 0; i < lobbySlots.Length; ++i)
            {
                if (lobbySlots[i] != null)
                {
                    allready &= lobbySlots[i].readyToBegin;
                }
            }

            if (allready)
            {
                for (int i = 0; i < lobbySlots.Length; ++i)
                {
                    if (lobbySlots[i] != null)
                    {
                        (lobbySlots[i] as LobbyPlayer).RpcUpdateCountdown();
                    }
                }
                ServerChangeScene(playScene);
                m_SceneChangeMode = SceneChangeMode.Game;
                state             = GameState.InGame;
            }
        }
    public void SceneChangeEventSet(SceneState sceneState, SceneChangeMode sceneChangeMode)
    {
        sceneStates_.Add(sceneState);
        sceneChangeModes_.Add(sceneChangeMode);

        sceneEvent_.func_add(SceneChangeEvent);
    }
Пример #6
0
        /// <summary>
        /// Update is called once per frame
        /// </summary>
        void Update()
        {
            if (_sceneChangeMode != SceneChangeMode.None)
            {
                if (_sceneChangeMode == SceneChangeMode.Menu)
                {
                    if (state != NetworkState.Inactive)
                    {
                        ServerChangeScene(MainMenuSceneName);
                        if (gameType == NetworkGameType.SinglePlayer)
                        {
                            state = NetworkState.Pregame;
                        }
                        else
                        {
                            state = NetworkState.InLobby;
                        }
                    }
                    else
                    {
                        SceneManager.LoadScene(MainMenuSceneName);
                    }
                }
                else
                {
                    ServerChangeScene(GameSceneName);

                    state = NetworkState.InGame;
                }

                _sceneChangeMode = SceneChangeMode.None;
            }
        }
    public void SceneChange(SceneState nextScene, SceneChangeMode sceneChangeMode)
    {
        SceneActive_ = false;

        nextSceneState_ = nextScene;

        sceneChangeModeState.state_ = sceneChangeMode;
    }
Пример #8
0
 /// <summary>
 /// Makes the server change to the menu scene, and bring all clients with it
 /// </summary>
 public void ReturnToMenu(MenuPage returnPage)
 {
     MainMenuUI.s_ReturnPage = returnPage;
     m_SceneChangeMode       = SceneChangeMode.Menu;
     {
         // Show loading screen
         LoadingModal loading = LoadingModal.s_Instance;
         if (loading != null)
         {
             loading.FadeIn();
         }
     }
 }
Пример #9
0
        /// <summary>
        /// Progress to game scene when in transitioning state
        /// </summary>
        protected virtual void Update()
        {
            if (m_SceneChangeMode != SceneChangeMode.None)
            {
                LoadingModal modal = LoadingModal.s_Instance;

                bool ready = true;
                if (modal != null)
                {
                    ready = modal.readyToTransition;

                    if (!ready && modal.fader.currentFade == Fade.None)
                    {
                        modal.FadeIn();
                    }
                }

                if (ready)
                {
                    if (m_SceneChangeMode == SceneChangeMode.Menu)
                    {
                        if (state != NetworkState.Inactive)
                        {
                            ServerChangeScene(s_LobbySceneName);
                            if (gameType == NetworkGameType.Singleplayer)
                            {
                                state = NetworkState.Pregame;
                            }
                            else
                            {
                                state = NetworkState.InLobby;
                            }
                        }
                        else
                        {
                            SceneManager.LoadScene(s_LobbySceneName);
                        }
                    }
                    else
                    {
                        MapDetails map = GameSettings.s_Instance.map;

                        ServerChangeScene(map.sceneName);

                        state = NetworkState.InGame;
                    }

                    m_SceneChangeMode = SceneChangeMode.None;
                }
            }
        }
Пример #10
0
        /// <summary>
        /// Makes the server change to the correct game scene for our map, and tells all clients to do the same
        /// </summary>
        public void ProgressToGameScene()
        {
            ClearAllReadyStates();

            UnlistMatch();
            m_SceneChangeMode = SceneChangeMode.Game;
            for (int i = 0; i < connectedPlayers.Count; ++i)
            {
                NetworkPlayer player = connectedPlayers[i];
                if (player != null)
                {
                    player.RpcPrepareForLoad();
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Makes the server change to the correct game scene for our map, and tells all clients to do the same
        /// </summary>
        public void ProgressToGameScene()
        {
            // Clear all client's ready states
            ClearAllReadyStates();

            // Remove us from matchmaking lists
            UnlistMatch();

            // Update will change scenes once loading screen is visible
            m_SceneChangeMode = SceneChangeMode.Game;

            // Tell NetworkPlayers to show their loading screens
            for (int i = 0; i < connectedPlayers.Count; ++i)
            {
                NetworkPlayer player = connectedPlayers[i];
                if (player != null)
                {
                    player.RpcPrepareForLoad();
                }
            }
        }
 public SceneChangeModeState(SceneChangeMode setState)
 {
     state_ = setState;
 }