public Coroutine LoadLevel(Package.Asset asset, string playerScene, string uiScene, SimulationMetaData ngs, bool forceEnvironmentReload = false) { LoadingManager lm = Singleton <LoadingManager> .instance; bool activated = ngs.m_updateMode == SimulationManager.UpdateMode.LoadGame || ngs.m_updateMode == SimulationManager.UpdateMode.NewGameFromMap || ngs.m_updateMode == SimulationManager.UpdateMode.NewGameFromScenario || Input.GetKey(KeyCode.LeftControl); instance.simulationFailed = instance.assetsStarted = instance.assetsFinished = false; if (!lm.m_currentlyLoading && !lm.m_applicationQuitting) { if (lm.m_LoadingWrapper != null) { lm.m_LoadingWrapper.OnLevelUnloading(); // OnLevelUnloading } if (activated) { Settings s = Settings.settings; Util.DebugPrint("Options: 121", s.loadEnabled, s.loadUsed, s.shareTextures, s.shareMaterials, s.shareMeshes, s.reportAssets, s.skipPrefabs); LoadingManager.instance.SetSceneProgress(0f); instance.cityName = asset?.name ?? "NewGame"; Profiling.Init(); CustomDeserializer.Create(); Fixes.Create().Deploy(); LoadingScreen.Create().Setup(); } lm.LoadingAnimationComponent.enabled = true; lm.m_currentlyLoading = true; lm.m_metaDataLoaded = false; lm.m_simulationDataLoaded = false; lm.m_loadingComplete = false; lm.m_renderDataReady = false; lm.m_essentialScenesLoaded = false; lm.m_brokenAssets = string.Empty; Util.Set(lm, "m_sceneProgress", 0f); Util.Set(lm, "m_simulationProgress", 0f); if (activated) { Profiling.Start(); } lm.m_loadingProfilerMain.Reset(); lm.m_loadingProfilerSimulation.Reset(); lm.m_loadingProfilerScenes.Reset(); //LoadingManager.instance.m_loadingProfilerCustomContent.Reset(); //LoadingManager.instance.m_loadingProfilerCustomAsset.Reset(); IEnumerator iter = activated ? instance.LoadLevelCoroutine(asset, playerScene, uiScene, ngs, forceEnvironmentReload) : (IEnumerator)Util.Invoke(lm, "LoadLevelCoroutine", asset, playerScene, uiScene, ngs, forceEnvironmentReload); return(lm.StartCoroutine(iter)); } return(null); }
public Coroutine LoadLevel(Package.Asset asset, string playerScene, string uiScene, SimulationMetaData ngs) { LoadingManager lm = Singleton <LoadingManager> .instance; instance.activated = ngs.m_updateMode == SimulationManager.UpdateMode.LoadGame || ngs.m_updateMode == SimulationManager.UpdateMode.NewGameFromMap || ngs.m_updateMode == SimulationManager.UpdateMode.NewGameFromScenario || Input.GetKey(KeyCode.LeftControl); instance.simulationFailed = false; if (!lm.m_currentlyLoading && !lm.m_applicationQuitting) { if (lm.m_LoadingWrapper != null) { lm.m_LoadingWrapper.OnLevelUnloading(); } if (instance.activated) { instance.cityName = asset?.name ?? "NewGame"; Profiling.Init(); new AssetLoader().Setup(); new LoadingScreen().Setup(); } lm.LoadingAnimationComponent.enabled = true; lm.m_currentlyLoading = true; lm.m_metaDataLoaded = false; lm.m_simulationDataLoaded = false; lm.m_loadingComplete = false; lm.m_renderDataReady = false; lm.m_essentialScenesLoaded = false; lm.m_brokenAssets = string.Empty; Util.Set(lm, "m_sceneProgress", 0f); Util.Set(lm, "m_simulationProgress", 0f); if (instance.activated) { Profiling.stopWatch.Start(); } lm.m_loadingProfilerMain.Reset(); lm.m_loadingProfilerSimulation.Reset(); lm.m_loadingProfilerScenes.Reset(); IEnumerator iter = instance.activated ? instance.LoadLevelCoroutine(asset, playerScene, uiScene, ngs) : (IEnumerator)Util.Invoke(lm, "LoadLevelCoroutine", asset, playerScene, uiScene, ngs); return(lm.StartCoroutine(iter)); } return(null); }
public static void LoadLevel() { PrefsManager.UpdatePrefs(); loadingManager.StartCoroutine(LoadSceneAsynchronously(levelToLoad)); }