IEnumerator LoadMainMenu() { m_loader = ApplicationDZ.LoadLevelAsync("MainMenu"); yield return(m_loader); Destroy(gameObject); }
// Use this for initialization void Start() { GameObject.DontDestroyOnLoad(gameObject); int count = 0; if (null != BundleSettingsManager.Instance) { count++; } if (null != FundSettingsManager.Instance) { count++; } if (null != HatSettingsManager.Instance) { count++; } if (null != ItemSettingsManager.Instance) { count++; } if (null != PerkSettingsManager.Instance) { count++; } if (null != SkinSettingsManager.Instance) { count++; } if (null != TechSettingsManager.Instance) { count++; } if (null != UpgradeSettingsManager.Instance) { count++; } if (null != WeaponSettingsManager.Instance) { count++; } //Debug.Log("Settings: " + count); ApplicationDZ.LoadLevel("MainMenu"); }
void LoadGui() { ApplicationDZ.LoadLevelAdditive("Gui_16_9"); }
IEnumerator LoadScene(string scene, bool mission) { IsLoading = true; string sceneLower = scene.ToLower(); if (sceneLower.StartsWith("mp_")) { scene = sceneLower; } // save user settings SaveSettings(); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); // waiting for 2 frames is necessary here!!! // display loading screen { // fade to black MFGuiFader.FadeIn(MFGuiFader.NORMAL); while (MFGuiFader.Fading == true) { yield return(new WaitForEndOfFrame()); } // do some cleaning and display loading screen ClearInstances(); if (AppType == E_AppType.DedicatedServer) { ApplicationDZ.LoadLevel("Empty"); } else { ApplicationDZ.LoadLevel(LoadingScreen); } // prepare fade-out MFGuiFader.FadeOut(MFGuiFader.NORMAL); MFGuiFader.Paused = true; // wait two frame // this causes much nicer initial delta time for fading yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); // finish fade-out MFGuiFader.Paused = false; while (MFGuiFader.Fading == true) { yield return(new WaitForEndOfFrame()); } } // apply graphic settings if (DeviceInfo.PerformanceGrade != (DeviceInfo.Performance)GuiOptions.graphicDetail) { DeviceInfo.Initialize((DeviceInfo.Performance)GuiOptions.graphicDetail); } // load scene { // do another cleaning and load scene ClearInstances(); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); // waiting for 2 frames is necessary here!!! yield return(Resources.UnloadUnusedAssets()); yield return(new WaitForEndOfFrame()); ApplicationDZ.LoadLevel(scene); // prepare fade-out MFGuiFader.FadeOut(MFGuiFader.SLOW); MFGuiFader.Paused = true; // waint two frames so game has time to initialize yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); //yield return Resources.UnloadUnusedAssets(); } if (mission) { if (Client.Instance) { Client.Instance.OnMissionLoaded(scene); } #if !DEADZONE_CLIENT if (Server.Instance) { Server.Instance.OnMissionLoaded(scene); } #endif } System.GC.Collect(); // clear input buffers InputManager.FlushInput(); // loading finished IsLoading = false; DownloadingLevel = null; // wait one frame // this causes much nicer initial delta time for fading yield return(new WaitForEndOfFrame()); // finish fade-out MFGuiFader.Paused = false; while (MFGuiFader.Fading == true) { yield return(new WaitForEndOfFrame()); } }