コード例 #1
0
ファイル: SceneLauncher.cs プロジェクト: nazarov-andrey/Dust
        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);
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
 /// <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);
     }
 }
コード例 #4
0
        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));
            }
        }
コード例 #5
0
 private void OnLoadCompleted(ILoadOperation loadOperation)
 {
     //MessageBox.Show("LoadCompleted");
 }