예제 #1
0
        /// <summary>Loads the last loaded scene from the currently active folder</summary>
        /// <returns>`true` if scene was loaded, otherwise `false`</returns>
        private bool LoadLastLoadedScene()
        {
            var navigated       = false;
            var clearNavigation = !_navigationInProgress;

            _navigationInProgress = true;
            try
            {
                var nextImage = GetLastLoadedScene(ScenePaths.LastOrDefault());

                if (nextImage != default)
                {
                    nextImage = PathUtils.NormalizePath(Path.Combine(_currentSceneFolder, nextImage));

                    if (File.Exists(nextImage))
                    {
                        _currentScenePathCandidate = nextImage;
                        StartCoroutine(Singleton <Studio.Studio> .Instance.LoadSceneCoroutine(nextImage));
                        navigated = true;
                    }
                }
            }
            finally
            {
                if (!navigated)
                {
                    Logger.LogErrorMessage(
                        $"Error loading last scene from {_currentSceneFolder}");
                    if (clearNavigation)
                    {
                        _navigationInProgress = false;
                    }
                }
            }

            return(navigated);
        }