private static Exception Finalizer(Exception __exception) { if (__exception != null) { if (__exception.GetType() == typeof(SocketException)) { if (MPInternet.Enabled) { NetworkMatch.CreateGeneralUIPopup("ERROR connecting to server", __exception.Message, 5.0f); NetworkMatch.ExitMatchToMainMenu(); } return(null); } } // forward all other exceptions return(__exception); }
static IEnumerator WaitLevel(string name) { while (MPDownloadLevel.DownloadBusy) { yield return(null); } if (GameManager.MultiplayerMission.FindAddOnLevelNumByIdStringHash(name) >= 0) // test here to prevent loop { Debug.Log("Level downloaded, loading scene"); Overload.NetworkManager.LoadScene(name); } else { Debug.Log("Match scene load failed: level still not found after download finished " + name); UIManager.DestroyAll(true); NetworkMatch.ExitMatchToMainMenu(); } }
static bool Prefix() { if (Server.IsActive() && LevelError_UserLevelLoader_Awake.loadError) { // End match, disconnect clients and do minor server cleanup LevelError_UserLevelLoader_Awake.loadError = false; Debug.Log("Server error loading map, killing match"); AccessTools.Method(typeof(NetworkMatch), "NetSystemNotifyMatchOver").Invoke(null, null); NetworkMatch.ExitMatchToMainMenu(); GameManager.m_player_ship = PlayerShip.Instantiate(); GameManager.m_local_player = GameManager.m_player_ship.c_player; AccessTools.Field(typeof(GameplayManager), "m_level_is_loaded").SetValue(null, true); AccessTools.Field(typeof(GameplayManager), "m_async_operation").SetValue(null, SceneManager.LoadSceneAsync(String.Empty)); return(false); } return(true); }