protected virtual void OnSceneStarted(SceneLoadingEventArgs e) { if (e == null) { throw new System.ArgumentNullException("e"); } if (this.SceneStarted != null) { this.SceneStarted(this, e); } }
private System.Collections.IEnumerator DoLoad() { if(_lastScene != null) { //end last scene var endInstruction = _lastScene.EndScene(); if (endInstruction != null) yield return endInstruction; if(_manager._lastSceneBehaviour == _lastScene) _manager._lastSceneBehaviour = null; } var args = new SceneLoadingEventArgs(_manager, _options); object[] instructions; //signal about to load _options.OnBeforeSceneLoaded(_manager, args); _manager.OnBeforeSceneLoaded(args); if (args.ShouldStall(out instructions)) yield return new WaitForAllComplete(GameLoopEntry.Hook, instructions); //do load var scene = _options.GetScene(_manager); _loadOp = (scene != null) ? scene.LoadAsync() : RadicalYieldInstruction.Null; yield return _loadOp; //get scene behaviour var sceneBehaviour = _options.LoadCustomSceneBehaviour(_manager); if(sceneBehaviour == null) { var go = new GameObject("SceneBehaviour"); go.transform.parent = _manager.transform; go.transform.localPosition = Vector3.zero; sceneBehaviour = go.AddComponent<SceneBehaviour>(); } SceneBehaviour.SceneLoadedInstance = sceneBehaviour; _manager._currentSceneBehaviour = sceneBehaviour; //signal loaded _options.OnSceneLoaded(_manager, args); _manager.OnSceneLoaded(args); if (args.ShouldStall(out instructions)) yield return new WaitForAllComplete(GameLoopEntry.Hook, instructions); else yield return null; //wait one last frame to actually begin the scene //signal scene begun _started = true; var beginInstruction = sceneBehaviour.BeginScene(); _options.OnSceneStarted(_manager, args); _manager.OnSceneStarted(args); if (args.ShouldStall(out instructions)) { var waitAll = new WaitForAllComplete(GameLoopEntry.Hook, instructions); if (beginInstruction != null) waitAll.Add(beginInstruction); beginInstruction = waitAll; } if (beginInstruction != null) yield return beginInstruction; _manager._loadingOp = null; this.SetSignal(); }
protected virtual void OnSceneStarted(SceneLoadingEventArgs e) { if (e == null) throw new System.ArgumentNullException("e"); if (this.SceneStarted != null) this.SceneStarted(this, e); }
private System.Collections.IEnumerator DoLoad() { if (_lastScene != null) { //end last scene var endInstruction = _lastScene.EndScene(); if (endInstruction != null) { yield return(endInstruction); } if (_manager._lastSceneBehaviour == _lastScene) { _manager._lastSceneBehaviour = null; } } var args = new SceneLoadingEventArgs(_manager, _options); object[] instructions; //signal about to load _options.OnBeforeSceneLoaded(_manager, args); _manager.OnBeforeSceneLoaded(args); if (args.ShouldStall(out instructions)) { yield return(new WaitForAllComplete(GameLoopEntry.Hook, instructions)); } //do load var scene = _options.GetScene(_manager); _loadOp = (scene != null) ? scene.LoadAsync() : RadicalYieldInstruction.Null; yield return(_loadOp); //get scene behaviour var sceneBehaviour = _options.LoadCustomSceneBehaviour(_manager); if (sceneBehaviour == null) { var go = new GameObject("SceneBehaviour"); go.transform.parent = _manager.transform; go.transform.localPosition = Vector3.zero; sceneBehaviour = go.AddComponent <SceneBehaviour>(); } SceneBehaviour.SceneLoadedInstance = sceneBehaviour; _manager._currentSceneBehaviour = sceneBehaviour; //signal loaded _options.OnSceneLoaded(_manager, args); _manager.OnSceneLoaded(args); if (args.ShouldStall(out instructions)) { yield return(new WaitForAllComplete(GameLoopEntry.Hook, instructions)); } else { yield return(null); //wait one last frame to actually begin the scene } //signal scene begun _started = true; var beginInstruction = sceneBehaviour.BeginScene(); _options.OnSceneStarted(_manager, args); _manager.OnSceneStarted(args); if (args.ShouldStall(out instructions)) { var waitAll = new WaitForAllComplete(GameLoopEntry.Hook, instructions); if (beginInstruction != null) { waitAll.Add(beginInstruction); } beginInstruction = waitAll; } if (beginInstruction != null) { yield return(beginInstruction); } _manager._loadingOp = null; this.SetSignal(); }
protected virtual void OnSceneLoaded(SceneManager manager, SceneLoadingEventArgs e) { if (this.SceneLoaded != null) this.SceneLoaded(e); }
void ISceneBehaviourLoadOptions.OnBeforeSceneLoaded(SceneManager manager, SceneLoadingEventArgs e) { this.OnBeforeSceneLoaded(manager, e); }
void ISceneBehaviourLoadOptions.OnSceneStarted(SceneManager manager, SceneLoadingEventArgs e) { this.OnSceneStarted(manager, e); }
void ISceneLoadOptions.OnSceneLoaded(SceneManager manager, SceneLoadingEventArgs e) { this.OnSceneLoaded(manager, e); }
protected virtual void OnSceneStarted(SceneManager manager, SceneLoadingEventArgs e) { }
protected virtual void OnBeforeSceneLoaded(SceneManager manager, SceneLoadingEventArgs e) { }
void ISceneLoadOptions.OnSceneStarted(SPSceneManager manager, SceneLoadingEventArgs e) { this.OnSceneStarted(manager, e); }
protected virtual void OnSceneStarted(SPSceneManager manager, SceneLoadingEventArgs e) { }
void ISceneLoadOptions.OnBeforeSceneLoaded(SPSceneManager manager, SceneLoadingEventArgs e) { this.OnBeforeSceneLoaded(manager, e); }
protected virtual void OnBeforeSceneLoaded(SPSceneManager manager, SceneLoadingEventArgs e) { }