Example #1
0
        internal async UniTask <ASceneGroup> LoadAsync(AReporter reporter)
        {
            reporter.SetCurrentSceneGroup(this);
            await reporter.InternalPrepareAsync();

            if (Ordering == E_SCENE_LOAD_ORDERING.RANDOM)
            {
                this.Scenes = SceneTypes.Select(x => (AScene)Activator.CreateInstance(x)).ToArray();
                var sceneLoadTasks = Scenes.Select(x => x.LoadAsync(reporter));
                await UniTask.WhenAll(sceneLoadTasks)
                .ContinueWith(async() => await PreLoadAsync(Scenes, reporter))
                .ContinueWith(async() => await reporter.ReportEnd());
            }
            else
            {
                this.Scenes = SceneTypes.Select(x => (AScene)Activator.CreateInstance(x)).ToArray();
                foreach (var scene in Scenes)
                {
                    await scene.LoadAsync(reporter);
                }
                await PreLoadAsync(Scenes, reporter);

                await reporter.ReportEnd();
            }
            reporter.SetCurrentSceneGroup(null);
            await AfterLoadAsync(Scenes);

            return(this);
        }
Example #2
0
        public async UniTask LoadAsync(AReporter reporter, UnityEngine.SceneManagement.LoadSceneMode loadSceneMode = UnityEngine.SceneManagement.LoadSceneMode.Additive)
        {
            await reporter.Report(null);

            this.LoadAsyncOperation = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(this.SceneBuildIndex, loadSceneMode);
            while (!this.LoadAsyncOperation.isDone)
            {
                await reporter.Report(null);

                await UniTask.Delay(16);
            }
            await reporter.Report(null);
        }
Example #3
0
 public void RegisterReporter <T>(T reporter) where T : AReporter
 {
     this.Reporter = reporter;
 }
Example #4
0
 public void RegisterReporter <T>() where T : AReporter
 {
     this.Reporter = Activator.CreateInstance <T>();
 }