public void Launch( string scene, bool unloadCurrent = true, Action <DiContainer> extraBindings = null) { if (unloadCurrent && !string.IsNullOrEmpty(currentScene)) { SceneManager.UnloadSceneAsync(currentScene); } currentScene = scene; if (IsBuildInScene(scene)) { loadOperation = new AsyncOperationLoadOperation( zenjectSceneLoader.LoadSceneAsync(scene, LoadSceneMode.Additive, extraBindings)); } else { loadOperation = new AssetBundleLoadOperation( zenjectAssetBundleSceneLoader.LoadSceneAsync(scene, LoadSceneMode.Additive, extraBindings)); } preloaderController.Display(); tickableManager.Add(this); }
public override void Load(object userState) { _currentUserState = userState; if (IsBusy) { return; } if (RemoteCollectionView.PageIndex < 0) { return; } IsBusy = true; LoadStarted?.Invoke(this, EventArgs.Empty); try { CurrentOperation = _load(); } catch (Exception) { IsBusy = false; throw; } }
/// <summary> /// 增加依赖操作。 /// </summary> /// <param name="operation">操作</param> /// <param name="level">依赖等级</param> public void AddDependency(ILoadOperation operation, DependencyLevel level) { if (level == DependencyLevel.Required) { mRequires.Add(operation); } else if (level == DependencyLevel.Decorate) { mDecorations.Add(operation); } else if (level == DependencyLevel.Reference) { mReferences.Add(operation); } }
private void OnLoadCompleted(object sender, EventArgs e) { IsBusy = false; var op = (ILoadOperation)sender; _onLoadCompleted?.Invoke(op); if (op == CurrentOperation) { OnLoadCompleted(new AsyncCompletedEventArgs(op.Error, op.IsCanceled, _currentUserState)); _currentUserState = null; CurrentOperation = null; } else { OnLoadCompleted(new AsyncCompletedEventArgs(op.Error, op.IsCanceled, null)); } }
private void OnLoadCompleted(ILoadOperation loadOperation) { //MessageBox.Show("LoadCompleted"); }