diff --git a/Assets/Darkmatter/Code/Features/ColorbookFlow/System/ColorbookFlowController.cs b/Assets/Darkmatter/Code/Features/ColorbookFlow/System/ColorbookFlowController.cs index 6a668fe..1d73d26 100644 --- a/Assets/Darkmatter/Code/Features/ColorbookFlow/System/ColorbookFlowController.cs +++ b/Assets/Darkmatter/Code/Features/ColorbookFlow/System/ColorbookFlowController.cs @@ -24,6 +24,7 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable private IDisposable _selectedSub; private IDisposable _returnToMainMenuSubscription; + private bool _navigatingToGameplay; public ColorbookFlowController( IDrawingCatalogController drawingCatalog, @@ -37,6 +38,7 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable _progression = progression; _scenes = scenes; _bus = bus; + _selectedSub = _bus.Subscribe(OnDrawingSelected); } public async UniTask StartAsync(CancellationToken cancellation = new CancellationToken()) @@ -44,8 +46,7 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable _returnToMainMenuSubscription = _bus.Subscribe(OnReturnToMainMenu); _loadingScreen.SetProgress(1f); await _drawingCatalog.InitializeAsync(cancellation); - _selectedSub = _bus.Subscribe(OnDrawingSelected); - _loadingScreen.Hide(); + if (!_navigatingToGameplay) _loadingScreen.Hide(); } private void OnReturnToMainMenu(ReturnToMainMenuSignal signal) @@ -65,6 +66,7 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable private void OnDrawingSelected(DrawingSelectedSignal signal) { + _navigatingToGameplay = true; HandleSelectionAsync(signal.TemplateId).Forget(); } diff --git a/Assets/Darkmatter/Code/Features/GameplayFlow/Systems/GameplayFlowController.cs b/Assets/Darkmatter/Code/Features/GameplayFlow/Systems/GameplayFlowController.cs index 1168e5b..f6d7b6a 100644 --- a/Assets/Darkmatter/Code/Features/GameplayFlow/Systems/GameplayFlowController.cs +++ b/Assets/Darkmatter/Code/Features/GameplayFlow/Systems/GameplayFlowController.cs @@ -13,6 +13,7 @@ using Darkmatter.Core.Contracts.Services.Gallery; using Darkmatter.Core.Contracts.Services.Scenes; using Darkmatter.Core.Data.Dynamic.Features.Progression; using Darkmatter.Core.Data.Signals.Features.Coloring; +using Darkmatter.Core.Data.Signals.Features.Drawing; using Darkmatter.Core.Data.Signals.Features.ShapeBuilder; using Darkmatter.Core.Enums.Features.Progression; using Darkmatter.Core.Enums.Services.Scenes; @@ -109,8 +110,8 @@ namespace Darkmatter.Features.GameplayFlow.Systems _loadingScreen.Show(); _shapeBuilder.Clear(); _coloring.Clear(); - await _scenes.LoadSceneAsync(GameScene.Colorbook, progress: null, cancellationToken: ct); - await _scenes.UnloadSceneAsync(GameScene.Gameplay, progress: null, cancellationToken: ct); + await _scenes.LoadSceneAsync(nameof(GameScene.Colorbook), progress: null, cancellationToken: ct); + await _scenes.UnloadSceneAsync(nameof(GameScene.Gameplay), progress: null, cancellationToken: ct); } public async UniTask SaveAsync(CancellationToken ct) @@ -131,15 +132,17 @@ namespace Darkmatter.Features.GameplayFlow.Systems _loadingScreen.Show(); _shapeBuilder.Clear(); _coloring.Clear(); - await _scenes.LoadSceneAsync(GameScene.Colorbook, progress: null, cancellationToken: default); - await _scenes.UnloadSceneAsync(GameScene.Gameplay, progress: null, cancellationToken: default); + await _scenes.LoadSceneAsync(nameof(GameScene.Colorbook), progress: null, cancellationToken: default); + await _scenes.UnloadSceneAsync(nameof(GameScene.Gameplay), progress: null, cancellationToken: default); return; } - await _progression.SetLastOpenedAsync(nextId); + _loadingScreen.Show(); _shapeBuilder.Clear(); _coloring.Clear(); - await _scenes.LoadSceneAsync(GameScene.Gameplay, progress: null, cancellationToken: default); + await _scenes.LoadSceneAsync(nameof(GameScene.Colorbook), progress: null, cancellationToken: default); + await _scenes.UnloadSceneAsync(nameof(GameScene.Gameplay), progress: null, cancellationToken: default); + _bus.Publish(new DrawingSelectedSignal(nextId)); } public void OnApplicationPaused() diff --git a/Assets/Darkmatter/Content/.DS_Store b/Assets/Darkmatter/Content/.DS_Store new file mode 100644 index 0000000..3252b4c Binary files /dev/null and b/Assets/Darkmatter/Content/.DS_Store differ