Esempio n. 1
0
        private static IEnumerator SendSceneLoad(int connectionId)
        {
            // wait until we've received the loadout
            while (!NetworkMatch.m_player_loadout_data.ContainsKey(connectionId))
            {
                if (!NetworkMatch.m_players.ContainsKey(connectionId)) // disconnected?
                {
                    yield break;
                }
                yield return(null);
            }

            StringMessage levelNameMsg = new StringMessage(MPJoinInProgress.NetworkMatchLevelName());

            NetworkServer.SendToClient(connectionId, CustomMsgType.SceneLoad, levelNameMsg);
            Debug.Log("JIP: sending scene load " + levelNameMsg.value);

            if (NetworkMatch.GetMatchState() == MatchState.LOBBY_LOADING_SCENE)
            {
                yield break;
            }

            StringMessage sceneNameMsg = new StringMessage(GameplayManager.m_level_info.SceneName);

            NetworkServer.SendToClient(connectionId, CustomMsgType.SceneLoaded, sceneNameMsg);
            Debug.Log("JIP: sending scene loaded " + sceneNameMsg.value);
        }
Esempio n. 2
0
 private static void Postfix(NetworkMessage msg)
 {
     if (!NetworkMatch.InLobby())
     {
         int           connectionId = msg.conn.connectionId;
         StringMessage levelNameMsg = new StringMessage(MPJoinInProgress.NetworkMatchLevelName());
         NetworkServer.SendToClient(connectionId, CustomMsgType.SceneLoad, levelNameMsg);
         StringMessage sceneNameMsg = new StringMessage(GameplayManager.m_level_info.SceneName);
         NetworkServer.SendToClient(connectionId, CustomMsgType.SceneLoaded, sceneNameMsg);
         Debug.Log("JIP: sending scene load " + levelNameMsg.value);
         Debug.Log("JIP: sending scene loaded " + sceneNameMsg.value);
     }
 }
        private static void Postfix(NetworkMessage msg)
        {
            MatchState match_state = NetworkMatch.GetMatchState();

            if (match_state != MatchState.LOBBY && match_state != MatchState.LOBBY_LOAD_COUNTDOWN)
            {
                GameManager.m_gm.StartCoroutine(SendSceneLoad(msg.conn.connectionId));
            }
            else
            {
                string level       = MPJoinInProgress.NetworkMatchLevelName();
                bool   customLevel = (level != null)? level.Contains(':') : false;
                GameManager.m_gm.StartCoroutine(InformClientAboutOlmod(msg.conn.connectionId, customLevel, 0));
            }
        }
        private static IEnumerator SendSceneLoad(int connectionId)
        {
            // wait until we've received the loadout
            while (!NetworkMatch.m_player_loadout_data.ContainsKey(connectionId))
            {
                if (!NetworkMatch.m_players.ContainsKey(connectionId)) // disconnected?
                {
                    yield break;
                }
                yield return(null);
            }
            string level       = MPJoinInProgress.NetworkMatchLevelName();
            bool   customLevel = (level != null)? level.Contains(':') : false;

            if (customLevel && !MPTweaks.ClientHasMod(connectionId))
            {
                // client seems not to have olmod, warn it
                yield return(GameManager.m_gm.StartCoroutine(InformClientAboutOlmod(connectionId, customLevel, 8)));

                if (!NetworkMatch.m_players.ContainsKey(connectionId)) // disconnected?
                {
                    yield break;
                }
            }

            StringMessage levelNameMsg = new StringMessage(level);

            NetworkServer.SendToClient(connectionId, CustomMsgType.SceneLoad, levelNameMsg);
            Debug.Log("JIP: sending scene load " + levelNameMsg.value);

            if (NetworkMatch.GetMatchState() == MatchState.LOBBY_LOADING_SCENE)
            {
                yield break;
            }

            StringMessage sceneNameMsg = new StringMessage(GameplayManager.m_level_info.SceneName);

            NetworkServer.SendToClient(connectionId, CustomMsgType.SceneLoaded, sceneNameMsg);
            Debug.Log("JIP: sending scene loaded " + sceneNameMsg.value);
        }