void Update() { if (streamers.Length > 0) { bool initialized = true; float progress = 0; for (int i = 0; i < streamers.Length; ++i) { Streamer item = streamers[i]; progress += item.LoadingProgress / (float)streamers.Length; initialized = initialized && item.initialized; } if (LoadingProgressChanged != null) { LoadingProgressChanged.Invoke(progress); } if (initialized) { if (progress >= 1) { if (SceneLoaded != null) { SceneLoaded.Invoke(); } this.enabled = false; } } } }
private IEnumerator LoadViewAsyncInternal(string viewName, SceneLoaded sceneLoadedCallback = null) { AsyncOperation loadOperation = SceneManager.LoadSceneAsync(viewName, LoadSceneMode.Additive); if (loadOperation != null && OnLoadNewScene != null) { OnLoadNewScene.Invoke(); } if (loadOperation == null) { throw new InvalidOperationException(string.Format("ViewLoader: Unable to load {0}. Make sure that the scene is enabled in the Build Settings.", viewName)); } PreviousView = (CurrentView == null) ? viewName : CurrentView; CurrentView = viewName; while (!loadOperation.isDone) { yield return(null); } if (OnSceneIsLoaded != null) { OnSceneIsLoaded.Invoke(); } if (sceneLoadedCallback != null) { sceneLoadedCallback(); } }
private void OnSceneLoaded(ModScene scene) { if (SceneLoaded != null) { SceneLoaded.Invoke(scene); } }
private void OnSceneLoaded(UnityEngine.SceneManagement.Scene scene, LoadSceneMode loadSceneMode) { if (scene.name == _sceneIsLoading.ToString()) { _sceneIsLoading = Scene.None; _sceneLoadStartTime = 0f; SceneManager.UnloadSceneAsync(_loadingScene.ToString()); if (_callbackBySceneType.ContainsKey(scene.name)) { _callbackBySceneType[scene.name].Invoke(); _callbackBySceneType.Remove(scene.name); } Scene sceneValue; try { sceneValue = (Scene)Enum.Parse(typeof(Scene), scene.name); SceneLoaded?.Invoke(sceneValue); } catch (Exception ex) { Debug.LogError(ex); } Debug.Log("Scene load time = " + (Time.time - _sceneLoadStartTime) + " sec."); } }
private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { SceneManager.sceneLoaded -= OnSceneLoaded; var setActive = true; string key = null; if (SetActives.ContainsKey(scene.name)) { key = scene.name; } else if (SetActives.ContainsKey(scene.buildIndex.ToString())) { key = scene.buildIndex.ToString(); } if (!string.IsNullOrEmpty(key)) { setActive = SetActives[key]; SetActives.Remove(key); } if (setActive) { SceneManager.SetActiveScene(scene); } SetActives.Remove(key ?? scene.name); SceneLoaded?.Invoke(scene, mode); }
public void LoadScene(IEnumerable <Entity> entities, BTScript script) { Entities.Clear(); Entities.AddRange(entities); BTScript = script; SceneLoaded?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Called when a new scene is loaded. /// </summary> private void NotifySceneLoaded(string[] sceneNames) { foreach (var sceneName in sceneNames) { Logger.LogInfo("Scene Loaded: " + sceneName); } SceneLoaded?.Invoke(this, new SceneEventArgs(sceneNames)); }
static void ProcessSceneLoadSuccess(Scene scene) { s_AdditiveScenes.Add(scene); DispatchSceneLoadRequests(scene.name, new SceneLoadOperationArgs { Scene = scene, Status = OperationStatus.Success }); SceneLoaded.Invoke(scene, LoadSceneMode.Additive); }
private void CheckAllLoadedScene(NetworkingPlayer np) { m_PlayersLoadedNextScene.Add(np); if (!m_PlayersLoadedNextScene.IsSupersetOf(m_PlayerDetails.Keys)) { return; } SceneLoaded?.Invoke(m_PlayerDetails); }
public void LoadPreviousScene(SceneLoaded sceneLoadedCallback = null) { if (viewBackStack.Count > 0) { string viewToLoad = viewBackStack.Pop(); if (!string.IsNullOrEmpty(viewToLoad)) { LoadViewAsync(viewToLoad, sceneLoadedCallback); } } }
private IEnumerator LoadViewAsyncInternal(string viewName, SceneLoaded sceneLoadedCallback) { ToolManager.Instance.HideTools(); AsyncOperation loadOperation = SceneManager.LoadSceneAsync(viewName, LoadSceneMode.Additive); if (loadOperation == null) { throw new InvalidOperationException(string.Format("ViewLoader: Unable to load {0}. Make sure that the scene is enabled in the Build Settings.", viewName)); } string oldView = CurrentView; GameObject oldContent = GameObject.Find(oldView + "Content"); while (!loadOperation.isDone) { yield return(null); } Debug.Log("ViewLoader: Loaded " + viewName); CurrentView = viewName; GameObject newContent = GameObject.Find("Content"); if (oldContent) { ContentView contentView = oldContent.GetComponent <ContentView>(); if (contentView) { contentView.WillUnload(); } } if (newContent) { newContent.name = viewName + "Content"; newContent.transform.position = transform.position; newContent.transform.rotation = transform.rotation; newContent.transform.SetParent(gameObject.transform, true); } if (ToolManager.Instance) { ToolManager.Instance.UnselectAllTools(); } if (sceneLoadedCallback != null) { sceneLoadedCallback(newContent, oldView); } }
public void LoadViewAsync(string viewName, bool forwardNavigation = false, SceneLoaded sceneLoadedCallback = null) { if (string.IsNullOrEmpty(viewName)) { Debug.LogError("ViewLoader: no scene name specified when calling LoadViewAsync() - cannot load the scene"); return; } if (forwardNavigation && CurrentView != null && !IntroductionFlow.Instance) { switch (viewName) { case "EarthView": case "SunView": case "MarsView": case "MercuryView": case "VenusView": case "JupiterView": case "SaturnView": case "UranusView": case "NeptuneView": case "PlutoView": Debug.Log("Earth Stack is working"); viewBackStack.Push("GalaxyView"); viewBackStack.Push("SolarSystemView"); break; case "SagAStarView": case "S102View": case "S2View": Debug.Log("Earth Stack is working"); viewBackStack.Push("GalaxyView"); viewBackStack.Push("GalacticCenter"); break; case "SolarSystemView": case "GalacticCenter": Debug.Log("Earth Stack is working"); viewBackStack.Push("GalaxyView"); break; default: viewBackStack.Push(CurrentView); break; } //ToolManager.Instance.ShowBackButton(); } StartCoroutine(LoadViewAsyncInternal(viewName, sceneLoadedCallback)); }
static void AdditiveSceneLoaded(Scene scene, LoadSceneMode mode) { s_AdditiveScenes.Add(scene); SceneLoaded.Invoke(scene, mode); if (s_LoadSceneRequests.TryGetValue(scene.name, out var callbacks)) { foreach (var callback in callbacks) { callback(scene); } s_LoadSceneRequests.Remove(scene.name); } }
public void LoadViewAsync(string viewName, SceneLoaded sceneLoadedCallback = null) { if (string.IsNullOrEmpty(viewName)) { Debug.LogError("ViewLoader: no scene name specified when calling LoadViewAsync() - cannot load the scene"); return; } if (!IsIntroFlowScene(viewName) && viewName != null) { viewBackStack.Push(viewName); } StartCoroutine(LoadViewAsyncInternal(viewName, sceneLoadedCallback)); }
public void LoadViewAsync(string viewName, bool forwardNavigation = false, SceneLoaded sceneLoadedCallback = null) { if (string.IsNullOrEmpty(viewName)) { Debug.LogError("ViewLoader: no scene name specified when calling LoadViewAsync() - cannot load the scene"); return; } if (forwardNavigation && CurrentView != null && !IntroductionFlow.Instance) { viewBackStack.Push(CurrentView); ToolManager.Instance.ShowBackButton(); } StartCoroutine(LoadViewAsyncInternal(viewName, sceneLoadedCallback)); }
private void SceneLoadedWrapper(Scene scene, LoadSceneMode mode) { if (_fixedSceneNames != null && _fixedSceneNames.Contains(scene.name)) { SceneManager.SetActiveScene(scene); } if (SceneLoaded != null) { SceneLoaded.Invoke(scene, mode); } --NotFinishedRequests; _logger.InfoFormat("scene loaded {0}", scene.name); }
internal IEnumerable <SceneBuildStatus> changeSceneStatus(String file, ResourceProvider resourceProvider) { Stopwatch sw = new Stopwatch(); sw.Start(); sceneViewController.resetAllCameraPositions(); unloadScene(); SimObjectErrorManager.Clear(); foreach (var status in medicalController.openScene(file, resourceProvider)) { yield return(status); } SimSubScene defaultScene = medicalController.CurrentScene.getDefaultSubScene(); if (BeforeSceneLoadProperties != null) { BeforeSceneLoadProperties.Invoke(medicalController.CurrentScene); } if (defaultScene != null) { OgreSceneManager ogreScene = defaultScene.getSimElementManager <OgreSceneManager>(); SimulationScene medicalScene = defaultScene.getSimElementManager <SimulationScene>(); sceneViewController.createFromPresets(medicalScene.WindowPresets.Default, false); sceneViewController.createCameras(medicalController.CurrentScene); lightManager.sceneLoaded(medicalController.CurrentScene); if (SceneLoaded != null) { SceneLoaded.Invoke(medicalController.CurrentScene); } anatomyController.sceneLoaded(); } if (SimObjectErrorManager.HasErrors) { NotificationManager.showCallbackNotification("Errors loading the scene.\nClick for details.", MessageBoxIcons.Error, showLoadErrorGui); } sw.Stop(); Logging.Log.Debug("Scene '{0}' loaded in {1} ms", file, sw.ElapsedMilliseconds); }
static void AdditiveAddressableSceneLoaded(AsyncOperationHandle <SceneInstance> asyncOperation) { AddressablesLogger.Log($"[ADDRESSABLES] AdditiveAddressableSceneLoaded Status: {asyncOperation.Status}, Scene: " + (asyncOperation.Result.Scene.name ?? "NULL")); var scene = asyncOperation.Result.Scene; s_AdditiveScenes.Add(scene); s_AdditiveScenesInstances.Add(asyncOperation.Result); SceneLoaded.Invoke(scene, LoadSceneMode.Additive); if (s_LoadSceneRequests.TryGetValue(scene.name, out var callbacks)) { foreach (var callback in callbacks) { callback(scene); } s_LoadSceneRequests.Remove(scene.name); } }
internal static void Internal_OnSceneEvent(SceneEventType eventType, Scene scene, ref Guid sceneId) { switch (eventType) { case SceneEventType.Saving: SceneSaving?.Invoke(scene, sceneId); break; case SceneEventType.Saved: SceneSaved?.Invoke(scene, sceneId); break; case SceneEventType.SaveError: SceneSaveError?.Invoke(scene, sceneId); break; case SceneEventType.Loading: SceneLoading?.Invoke(scene, sceneId); break; case SceneEventType.Loaded: SceneLoaded?.Invoke(scene, sceneId); break; case SceneEventType.LoadError: SceneLoadError?.Invoke(scene, sceneId); break; case SceneEventType.Unloading: SceneUnloading?.Invoke(scene, sceneId); break; case SceneEventType.Unloaded: SceneUnloaded?.Invoke(scene, sceneId); break; } }
private void OnSceneLoaded() { SceneLoaded?.Invoke(this, EventArgs.Empty); }
public void OnSceneLoaded(string value) { SceneLoaded?.Invoke(value); }
private static void SceneManager_sceneLoaded(Scene scene, LoadSceneMode _) { SceneLoaded?.Invoke(scene.name); }
public static void OnSceneLoaded(string sceneName) { SceneLoaded?.Invoke(sceneName); }
private void OnSceneLoaded(Resource scene) { SceneLoaded?.Invoke((ModScene)scene); }
private static void HandleSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) => SceneLoaded?.Invoke(scene, loadSceneMode);