public IEnumerator LoadLevelCoroutine(Package.Asset asset, string playerScene, string uiScene, SimulationMetaData ngs) { string scene; int i; yield return(null); Util.InvokeVoid(LoadingManager.instance, "PreLoadLevel"); if (!LoadingManager.instance.LoadingAnimationComponent.AnimationLoaded) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading("LoadingAnimation"); yield return(SceneManager.LoadSceneAsync("LoadingAnimation", LoadSceneMode.Additive)); LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } AsyncTask task = Singleton <SimulationManager> .instance.AddAction("Loading", (IEnumerator)Util.Invoke(LoadingManager.instance, "LoadSimulationData", asset, ngs)); LoadSaveStatus.activeTask = task; if (LoadingManager.instance.m_loadedEnvironment == null) // loading from main menu { knownFailedAssets.Clear(); fastLoad = false; } else // loading from in-game (the pause menu) { while (!LoadingManager.instance.m_metaDataLoaded && !task.completedOrFailed) // IL_139 { yield return(null); } if (SimulationManager.instance.m_metaData == null) { SimulationManager.instance.m_metaData = new SimulationMetaData(); SimulationManager.instance.m_metaData.m_environment = "Sunny"; SimulationManager.instance.m_metaData.Merge(ngs); } Util.InvokeVoid(LoadingManager.instance, "MetaDataLoaded"); // No OnCreated string mapThemeName = SimulationManager.instance.m_metaData.m_MapThemeMetaData?.name; fastLoad = SimulationManager.instance.m_metaData.m_environment == LoadingManager.instance.m_loadedEnvironment && mapThemeName == LoadingManager.instance.m_loadedMapTheme; // The game is nicely optimized when loading from the pause menu. We must specifically address the following situation: // - environment (biome) stays the same // - map theme stays the same // - 'load used assets' is enabled // - not all assets used in the save being loaded are currently in memory. if (fastLoad) { if (Settings.settings.loadUsed && !IsKnownFastLoad(asset)) { i = Profiling.Millis; while (Profiling.Millis - i < 5000 && !IsSaveDeserialized()) { yield return(null); } fastLoad = AllAssetsAvailable(); } if (fastLoad) // optimized load { LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "EssentialScenesLoaded")); LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "RenderDataReady")); Util.DebugPrint("fast load at", Profiling.Millis); } else // fallback to full load { DestroyLoadedPrefabs(); LoadingManager.instance.m_loadedEnvironment = null; LoadingManager.instance.m_loadedMapTheme = null; Util.DebugPrint("not fast load at", Profiling.Millis); } } else // full load { // Notice that there is a race condition in the base game at this point: DestroyAllPrefabs ruins the simulation // if its deserialization has progressed far enough. Typically there is no problem. Util.InvokeVoid(LoadingManager.instance, "DestroyAllPrefabs"); LoadingManager.instance.m_loadedEnvironment = null; LoadingManager.instance.m_loadedMapTheme = null; Util.DebugPrint("full load at", Profiling.Millis); } } if (LoadingManager.instance.m_loadedEnvironment == null) // IL_27C { AsyncOperation op; knownFastLoads.Clear(); fullLoadTime = DateTime.Now; loadingLock = Util.Get(LoadingManager.instance, "m_loadingLock"); if (!string.IsNullOrEmpty(playerScene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(playerScene); op = SceneManager.LoadSceneAsync(playerScene, LoadSceneMode.Single); while (!op.isDone) // IL_2FF { LoadingManager.instance.SetSceneProgress(op.progress * 0.01f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } while (!LoadingManager.instance.m_metaDataLoaded && !task.completedOrFailed) // IL_33C { yield return(null); } if (SimulationManager.instance.m_metaData == null) { SimulationManager.instance.m_metaData = new SimulationMetaData(); SimulationManager.instance.m_metaData.m_environment = "Sunny"; SimulationManager.instance.m_metaData.Merge(ngs); } Util.InvokeVoid(LoadingManager.instance, "MetaDataLoaded"); // OnCreated if loading from the main manu KeyValuePair <string, float>[] levels = SetLevels(); float currentProgress = 0.10f; for (i = 0; i < levels.Length; i++) { scene = levels[i].Key; LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = SceneManager.LoadSceneAsync(scene, LoadSceneMode.Additive); while (!op.isDone) { LoadingManager.instance.SetSceneProgress(currentProgress + op.progress * (levels[i].Value - currentProgress)); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); currentProgress = levels[i].Value; } Queue <IEnumerator> mainThreadQueue; // Some major mods (Network Extensions 1 & 2, Single Train Track, Metro Overhaul) have a race condition issue // in their NetInfo Installer. Everything goes fine if LoadCustomContent() below is NOT queued before the // said Installers have finished. This is just a workaround for the issue. The actual fix should be in // the Installers. Notice that the built-in loader of the game is also affected. do { yield return(null); yield return(null); lock (loadingLock) { mainThreadQueue = (Queue <IEnumerator>)queueField.GetValue(LoadingManager.instance); i = mainThreadQueue.Count; } }while (i > 0); LoadingManager.instance.QueueLoadingAction(AssetLoader.instance.LoadCustomContent()); RenderManager.Managers_CheckReferences(); LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "EssentialScenesLoaded")); RenderManager.Managers_InitRenderData(); LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "RenderDataReady")); simulationFailed = HasFailed(task); // Performance optimization: do not load scenes while custom assets are loading. while (!AssetLoader.instance.hasFinished) { yield return(null); } scene = SimulationManager.instance.m_metaData.m_environment + "Properties"; if (!string.IsNullOrEmpty(scene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = SceneManager.LoadSceneAsync(scene, LoadSceneMode.Additive); while (!op.isDone) // IL_C47 { LoadingManager.instance.SetSceneProgress(0.85f + op.progress * 0.05f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } if (!simulationFailed) { simulationFailed = HasFailed(task); } if (!string.IsNullOrEmpty(uiScene)) // IL_C67 { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(uiScene); op = SceneManager.LoadSceneAsync(uiScene, LoadSceneMode.Additive); while (!op.isDone) // IL_CDE { LoadingManager.instance.SetSceneProgress(0.90f + op.progress * 0.08f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } LoadingManager.instance.m_loadedEnvironment = SimulationManager.instance.m_metaData.m_environment; // IL_CFE LoadingManager.instance.m_loadedMapTheme = SimulationManager.instance.m_metaData.m_MapThemeMetaData?.name; } else { scene = (string)Util.Invoke(LoadingManager.instance, "GetLoadingScene"); if (!string.IsNullOrEmpty(scene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); yield return(SceneManager.LoadSceneAsync(scene, LoadSceneMode.Additive)); LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } } LoadingManager.instance.SetSceneProgress(1f); // IL_DBF if (!simulationFailed) { simulationFailed = HasFailed(task); } while (!task.completedOrFailed) // IL_DED { yield return(null); } LoadingManager.instance.m_simulationDataLoaded = LoadingManager.instance.m_metaDataLoaded; LoadingManager.SimulationDataReadyHandler SimDataReady = Util.Get(LoadingManager.instance, "m_simulationDataReady") as LoadingManager.SimulationDataReadyHandler; SimDataReady?.Invoke(); SimulationManager.UpdateMode mode = SimulationManager.UpdateMode.Undefined; if (ngs != null) { mode = ngs.m_updateMode; } LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "LoadLevelComplete", mode)); // OnLevelLoaded if (Singleton <TelemetryManager> .exists) { Singleton <TelemetryManager> .instance.StartSession(asset?.name, playerScene, mode, SimulationManager.instance.m_metaData); } LoadingManager.instance.QueueLoadingAction(LoadingComplete()); knownFastLoads.Add(asset.fullName); AssetLoader.instance.PrintMem(); }
public IEnumerator LoadLevelCoroutine(Package.Asset asset, string playerScene, string uiScene, SimulationMetaData ngs) { string scene; yield return(null); LoadingManager.instance.SetSceneProgress(0f); Util.InvokeVoid(LoadingManager.instance, "PreLoadLevel"); AsyncTask task = Singleton <SimulationManager> .instance.AddAction("Loading", (IEnumerator)Util.Invoke(LoadingManager.instance, "LoadSimulationData", asset, ngs)); LoadSaveStatus.activeTask = task; if (!LoadingManager.instance.LoadingAnimationComponent.AnimationLoaded) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading("LoadingAnimation"); yield return(SceneManager.LoadSceneAsync("LoadingAnimation", LoadSceneMode.Additive)); LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } if (LoadingManager.instance.m_loadedEnvironment == null) // loading from main menu { knownToFail.Clear(); fastLoad = false; } else // loading from in-game (the pause menu) { while (!LoadingManager.instance.m_metaDataLoaded && !task.completedOrFailed) // IL_139 { yield return(null); } if (SimulationManager.instance.m_metaData == null) { SimulationManager.instance.m_metaData = new SimulationMetaData(); SimulationManager.instance.m_metaData.m_environment = "Sunny"; SimulationManager.instance.m_metaData.Merge(ngs); } Util.InvokeVoid(LoadingManager.instance, "MetaDataLoaded"); string mapThemeName = SimulationManager.instance.m_metaData.m_MapThemeMetaData?.name; fastLoad = SimulationManager.instance.m_metaData.m_environment == LoadingManager.instance.m_loadedEnvironment && mapThemeName == LoadingManager.instance.m_loadedMapTheme; // The game is nicely optimized when loading from the pause menu. We must specifically address the following situation: // - environment (biome) stays the same // - map theme stays the same // - 'load used assets' is enabled // - not all assets and prefabs used in the save being loaded are currently in memory. if (fastLoad) { if (Settings.settings.loadUsed) { int startMillis = Profiling.Millis; while (Profiling.Millis - startMillis < 5000 && !IsSaveDeserialized()) { yield return(null); } fastLoad = !AnyMissingAssets(); } if (fastLoad) // optimized load { LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "EssentialScenesLoaded")); LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "RenderDataReady")); } else // fallback to full load { DestroyLoadedPrefabs(); LoadingManager.instance.m_loadedEnvironment = null; LoadingManager.instance.m_loadedMapTheme = null; } } else // full load { // Notice that there is a race condition in the base game at this point: DestroyAllPrefabs ruins the simulation // if its deserialization has progressed far enough. Typically there is no problem. Util.InvokeVoid(LoadingManager.instance, "DestroyAllPrefabs"); LoadingManager.instance.m_loadedEnvironment = null; LoadingManager.instance.m_loadedMapTheme = null; } } if (LoadingManager.instance.m_loadedEnvironment == null) // IL_27C { AsyncOperation op; if (!string.IsNullOrEmpty(playerScene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(playerScene); op = SceneManager.LoadSceneAsync(playerScene, LoadSceneMode.Single); while (!op.isDone) // IL_2FF { LoadingManager.instance.SetSceneProgress(op.progress * 0.1f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } while (!LoadingManager.instance.m_metaDataLoaded && !task.completedOrFailed) // IL_33C { yield return(null); } if (SimulationManager.instance.m_metaData == null) { SimulationManager.instance.m_metaData = new SimulationMetaData(); SimulationManager.instance.m_metaData.m_environment = "Sunny"; SimulationManager.instance.m_metaData.Merge(ngs); } Util.InvokeVoid(LoadingManager.instance, "MetaDataLoaded"); KeyValuePair <string, float>[] levels = SetLevels(); float currentProgress = 0.10f; for (int i = 0; i < levels.Length; i++) { scene = levels[i].Key; if (string.IsNullOrEmpty(scene)) // just a marker to stop prefab skipping { PrefabLoader.instance?.Revert(); continue; } LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = SceneManager.LoadSceneAsync(scene, LoadSceneMode.Additive); while (!op.isDone) { LoadingManager.instance.SetSceneProgress(currentProgress + op.progress * (levels[i].Value - currentProgress)); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); currentProgress = levels[i].Value; } if (Settings.settings.SkipAny) { yield return(null); PrefabLoader.instance?.DestroySkipped(); yield return(null); try { Resources.UnloadUnusedAssets(); } catch (Exception e) { UnityEngine.Debug.LogException(e); } yield return(null); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); yield return(null); } // LoadingManager.instance.QueueLoadingAction((IEnumerator) Util.Invoke(LoadingManager.instance, "LoadCustomContent")); // IL_B65 LoadingManager.instance.QueueLoadingAction(AssetLoader.instance.LoadCustomContent()); RenderManager.Managers_CheckReferences(); LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "EssentialScenesLoaded")); RenderManager.Managers_InitRenderData(); LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "RenderDataReady")); simulationFailed = HasFailed(task); // Performance optimization: do not load scenes while custom assets are loading. while (!AssetLoader.instance.hasFinished) { yield return(null); } scene = SimulationManager.instance.m_metaData.m_environment + "Properties"; if (!string.IsNullOrEmpty(scene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = SceneManager.LoadSceneAsync(scene, LoadSceneMode.Additive); while (!op.isDone) // IL_C47 { LoadingManager.instance.SetSceneProgress(0.74f + op.progress * 0.05f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } if (!simulationFailed) { simulationFailed = HasFailed(task); } if (!string.IsNullOrEmpty(uiScene)) // IL_C67 { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(uiScene); op = SceneManager.LoadSceneAsync(uiScene, LoadSceneMode.Additive); while (!op.isDone) // IL_CDE { LoadingManager.instance.SetSceneProgress(0.79f + op.progress * 0.2f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } LoadingManager.instance.m_loadedEnvironment = SimulationManager.instance.m_metaData.m_environment; // IL_CFE LoadingManager.instance.m_loadedMapTheme = SimulationManager.instance.m_metaData.m_MapThemeMetaData?.name; } else { scene = (string)Util.Invoke(LoadingManager.instance, "GetLoadingScene"); if (!string.IsNullOrEmpty(scene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); yield return(SceneManager.LoadSceneAsync(scene, LoadSceneMode.Additive)); LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } } LoadingManager.instance.SetSceneProgress(1f); // IL_DBF if (!simulationFailed) { simulationFailed = HasFailed(task); } while (!task.completedOrFailed) // IL_DED { yield return(null); } LoadingManager.instance.m_simulationDataLoaded = LoadingManager.instance.m_metaDataLoaded; LoadingManager.SimulationDataReadyHandler SimDataReady = Util.Get(LoadingManager.instance, "m_simulationDataReady") as LoadingManager.SimulationDataReadyHandler; SimDataReady?.Invoke(); SimulationManager.UpdateMode mode = SimulationManager.UpdateMode.Undefined; if (ngs != null) { mode = ngs.m_updateMode; } LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "LoadLevelComplete", mode)); if (Singleton <TelemetryManager> .exists) { Singleton <TelemetryManager> .instance.StartSession(asset?.name, playerScene, mode, SimulationManager.instance.m_metaData); } PrefabLoader.instance?.Dispose(); }
public IEnumerator LoadLevelCoroutine(Package.Asset asset, string playerScene, string uiScene, SimulationMetaData ngs) { string scene; yield return(null); LoadingManager.instance.SetSceneProgress(0f); Util.InvokeVoid(LoadingManager.instance, "PreLoadLevel"); AsyncTask task = Singleton <SimulationManager> .instance.AddAction("Loading", (IEnumerator)Util.Invoke(LoadingManager.instance, "LoadSimulationData", asset, ngs)); LoadSaveStatus.activeTask = task; if (!LoadingManager.instance.LoadingAnimationComponent.AnimationLoaded) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading("LoadingAnimation"); yield return(Application.LoadLevelAdditiveAsync("LoadingAnimation")); LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } if (LoadingManager.instance.m_loadedEnvironment != null) // loading from in-game { while (!LoadingManager.instance.m_metaDataLoaded && !task.completedOrFailed) // IL_158 { yield return(null); } if (Singleton <SimulationManager> .instance.m_metaData == null) { Singleton <SimulationManager> .instance.m_metaData = new SimulationMetaData(); Singleton <SimulationManager> .instance.m_metaData.m_environment = "Sunny"; Singleton <SimulationManager> .instance.m_metaData.Merge(ngs); } string mapThemeName = Singleton <SimulationManager> .instance.m_metaData.m_MapThemeMetaData?.name; if (Singleton <SimulationManager> .instance.m_metaData.m_environment == LoadingManager.instance.m_loadedEnvironment && mapThemeName == LoadingManager.instance.m_loadedMapTheme) { LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "EssentialScenesLoaded")); LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "RenderDataReady")); } else { Util.InvokeVoid(LoadingManager.instance, "DestroyAllPrefabs"); LoadingManager.instance.m_loadedEnvironment = null; LoadingManager.instance.m_loadedMapTheme = null; } } if (LoadingManager.instance.m_loadedEnvironment == null) // IL_290 { AsyncOperation op; if (!string.IsNullOrEmpty(playerScene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(playerScene); op = Application.LoadLevelAsync(playerScene); while (!op.isDone) // IL_312 { LoadingManager.instance.SetSceneProgress(op.progress * 0.1f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } while (!LoadingManager.instance.m_metaDataLoaded && !task.completedOrFailed) // IL_34F { yield return(null); } if (Singleton <SimulationManager> .instance.m_metaData == null) { Singleton <SimulationManager> .instance.m_metaData = new SimulationMetaData(); Singleton <SimulationManager> .instance.m_metaData.m_environment = "Sunny"; Singleton <SimulationManager> .instance.m_metaData.Merge(ngs); } LoadingManager.instance.m_supportsExpansion[0] = (bool)Util.Invoke(LoadingManager.instance, "DLC", 369150u); LoadingManager.instance.m_supportsExpansion[1] = (bool)Util.Invoke(LoadingManager.instance, "DLC", 420610u); bool isWinter = Singleton <SimulationManager> .instance.m_metaData.m_environment == "Winter"; if (isWinter && !LoadingManager.instance.m_supportsExpansion[1]) { Singleton <SimulationManager> .instance.m_metaData.m_environment = "Sunny"; isWinter = false; } scene = (string)Util.Invoke(LoadingManager.instance, "GetLoadingScene"); if (!string.IsNullOrEmpty(scene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_4D0 { LoadingManager.instance.SetSceneProgress(0.1f + op.progress * 0.03f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } scene = Singleton <SimulationManager> .instance.m_metaData.m_environment + "Prefabs"; // IL_4F0 if (!string.IsNullOrEmpty(scene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_585 { LoadingManager.instance.SetSceneProgress(0.13f + op.progress * 0.5f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } if ((bool)Util.Invoke(LoadingManager.instance, "DLC", 1u)) // IL_5A5 { scene = isWinter ? "WinterLoginPackPrefabs" : "LoginPackPrefabs"; LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_63C { LoadingManager.instance.SetSceneProgress(0.63f + op.progress * 0.02f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } if ((bool)Util.Invoke(LoadingManager.instance, "DLC", 340160u)) // IL_65C { scene = isWinter ? "WinterPreorderPackPrefabs" : "PreorderPackPrefabs"; LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_6F8 { LoadingManager.instance.SetSceneProgress(0.65f + op.progress * 0.02f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } scene = isWinter ? "WinterSignupPackPrefabs" : "SignupPackPrefabs"; // IL_718 LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_79F { LoadingManager.instance.SetSceneProgress(0.67f + op.progress * 0.01f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); if ((bool)Util.Invoke(LoadingManager.instance, "DLC", 346791u)) { scene = "DeluxePackPrefabs"; LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_846 { LoadingManager.instance.SetSceneProgress(0.68f + op.progress * 0.02f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } if (Steam.IsAppOwned(238370u)) // IL_866 { scene = "MagickaPackPrefabs"; LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_8ED { LoadingManager.instance.SetSceneProgress(0.7f + op.progress * 0.01f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } if (LoadingManager.instance.m_supportsExpansion[0]) // IL_90D { scene = isWinter ? "WinterExpansion1Prefabs" : "Expansion1Prefabs"; LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_9A6 { LoadingManager.instance.SetSceneProgress(0.71f + op.progress * 0.02f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } if (LoadingManager.instance.m_supportsExpansion[1]) // IL_9C6 { scene = "Expansion2Prefabs"; LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_A4A { LoadingManager.instance.SetSceneProgress(0.73f + op.progress * 0.02f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } Package.Asset europeanStyles = PackageManager.FindAssetByName("System." + DistrictStyle.kEuropeanStyleName); // IL_A6A if (europeanStyles != null && europeanStyles.isEnabled) { if (Singleton <SimulationManager> .instance.m_metaData.m_environment.Equals("Europe")) { scene = "EuropeNormalPrefabs"; } else { scene = "EuropeStylePrefabs"; } LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_B45 { LoadingManager.instance.SetSceneProgress(0.75f + op.progress * 0.02f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } // LoadingManager.instance.QueueLoadingAction((IEnumerator) Util.Invoke(LoadingManager.instance, "LoadCustomContent")); // IL_B65 LoadingManager.instance.QueueLoadingAction(AssetLoader.instance.LoadCustomContent()); RenderManager.Managers_CheckReferences(); LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "EssentialScenesLoaded")); RenderManager.Managers_InitRenderData(); LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "RenderDataReady")); simulationFailed = HasFailed(task); // Performance optimization: do not load scenes while custom assets are loading. while (!AssetLoader.instance.hasFinished) { yield return(null); } scene = Singleton <SimulationManager> .instance.m_metaData.m_environment + "Properties"; if (!string.IsNullOrEmpty(scene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); op = Application.LoadLevelAdditiveAsync(scene); while (!op.isDone) // IL_C47 { LoadingManager.instance.SetSceneProgress(0.77f + op.progress * 0.11f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } if (!simulationFailed) { simulationFailed = HasFailed(task); } if (!string.IsNullOrEmpty(uiScene)) // IL_C67 { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(uiScene); op = Application.LoadLevelAdditiveAsync(uiScene); while (!op.isDone) // IL_CDE { LoadingManager.instance.SetSceneProgress(0.88f + op.progress * 0.11f); yield return(null); } LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } LoadingManager.instance.m_loadedEnvironment = Singleton <SimulationManager> .instance.m_metaData.m_environment; // IL_CFE LoadingManager.instance.m_loadedMapTheme = Singleton <SimulationManager> .instance.m_metaData.m_MapThemeMetaData?.name; } else { scene = (string)Util.Invoke(LoadingManager.instance, "GetLoadingScene"); if (!string.IsNullOrEmpty(scene)) { LoadingManager.instance.m_loadingProfilerScenes.BeginLoading(scene); yield return(Application.LoadLevelAdditiveAsync(scene)); LoadingManager.instance.m_loadingProfilerScenes.EndLoading(); } } LoadingManager.instance.SetSceneProgress(1f); // IL_DBF if (!simulationFailed) { simulationFailed = HasFailed(task); } while (!task.completedOrFailed) // IL_DED { yield return(null); } LoadingManager.instance.m_simulationDataLoaded = LoadingManager.instance.m_metaDataLoaded; LoadingManager.SimulationDataReadyHandler SimDataReady = Util.Get(LoadingManager.instance, "m_simulationDataReady") as LoadingManager.SimulationDataReadyHandler; SimDataReady?.Invoke(); SimulationManager.UpdateMode mode = SimulationManager.UpdateMode.Undefined; if (ngs != null) { mode = ngs.m_updateMode; } LoadingManager.instance.QueueLoadingAction((IEnumerator)Util.Invoke(LoadingManager.instance, "LoadLevelComplete", mode)); if (Singleton <TelemetryManager> .exists) { Singleton <TelemetryManager> .instance.StartSession(asset?.name, playerScene, mode, Singleton <SimulationManager> .instance.m_metaData); } }