public UniTask <AsyncUnit> StartLoading(CancellationToken cancellationToken, int delayBeforeDestroy = 500) { this.delayBeforeViewDestroy = delayBeforeDestroy; uniTaskCompletionSource = new UniTaskCompletionSource <AsyncUnit>(); Initialize(); currentProgress = 0; var firstCommand = loadingManager.GetFirstCommand(); cachedViewEntity = new LoadingViewEntity() { CurrentProgress = currentProgress, CurrentCommand = 0, TotalCommands = loadingManager.TotalCommands, CurrentDescription = firstCommand.Description, }; loadingView.SetViewEntity(cachedViewEntity); Object.DontDestroyOnLoad(loadingView.ViewGameObject); loadingManager.StartPreloading(); return(uniTaskCompletionSource.Task); }
private void OnCommandCompletedHandler(ICommand command) { var viewEntity = new LoadingViewEntity() { CurrentProgress = CalculateProgress(1), CurrentCommand = loadingManager.CurrentCommandIndex, TotalCommands = loadingManager.TotalCommands, CurrentDescription = command.Description, }; loadingView.SetViewEntity(viewEntity); }