scene fix
This commit is contained in:
@@ -24,6 +24,7 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
|
|||||||
|
|
||||||
private IDisposable _selectedSub;
|
private IDisposable _selectedSub;
|
||||||
private IDisposable _returnToMainMenuSubscription;
|
private IDisposable _returnToMainMenuSubscription;
|
||||||
|
private bool _navigatingToGameplay;
|
||||||
|
|
||||||
public ColorbookFlowController(
|
public ColorbookFlowController(
|
||||||
IDrawingCatalogController drawingCatalog,
|
IDrawingCatalogController drawingCatalog,
|
||||||
@@ -37,6 +38,7 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
|
|||||||
_progression = progression;
|
_progression = progression;
|
||||||
_scenes = scenes;
|
_scenes = scenes;
|
||||||
_bus = bus;
|
_bus = bus;
|
||||||
|
_selectedSub = _bus.Subscribe<DrawingSelectedSignal>(OnDrawingSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async UniTask StartAsync(CancellationToken cancellation = new CancellationToken())
|
public async UniTask StartAsync(CancellationToken cancellation = new CancellationToken())
|
||||||
@@ -44,8 +46,7 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
|
|||||||
_returnToMainMenuSubscription = _bus.Subscribe<ReturnToMainMenuSignal>(OnReturnToMainMenu);
|
_returnToMainMenuSubscription = _bus.Subscribe<ReturnToMainMenuSignal>(OnReturnToMainMenu);
|
||||||
_loadingScreen.SetProgress(1f);
|
_loadingScreen.SetProgress(1f);
|
||||||
await _drawingCatalog.InitializeAsync(cancellation);
|
await _drawingCatalog.InitializeAsync(cancellation);
|
||||||
_selectedSub = _bus.Subscribe<DrawingSelectedSignal>(OnDrawingSelected);
|
if (!_navigatingToGameplay) _loadingScreen.Hide();
|
||||||
_loadingScreen.Hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnReturnToMainMenu(ReturnToMainMenuSignal signal)
|
private void OnReturnToMainMenu(ReturnToMainMenuSignal signal)
|
||||||
@@ -65,6 +66,7 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
|
|||||||
|
|
||||||
private void OnDrawingSelected(DrawingSelectedSignal signal)
|
private void OnDrawingSelected(DrawingSelectedSignal signal)
|
||||||
{
|
{
|
||||||
|
_navigatingToGameplay = true;
|
||||||
HandleSelectionAsync(signal.TemplateId).Forget();
|
HandleSelectionAsync(signal.TemplateId).Forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Darkmatter.Core.Contracts.Services.Gallery;
|
|||||||
using Darkmatter.Core.Contracts.Services.Scenes;
|
using Darkmatter.Core.Contracts.Services.Scenes;
|
||||||
using Darkmatter.Core.Data.Dynamic.Features.Progression;
|
using Darkmatter.Core.Data.Dynamic.Features.Progression;
|
||||||
using Darkmatter.Core.Data.Signals.Features.Coloring;
|
using Darkmatter.Core.Data.Signals.Features.Coloring;
|
||||||
|
using Darkmatter.Core.Data.Signals.Features.Drawing;
|
||||||
using Darkmatter.Core.Data.Signals.Features.ShapeBuilder;
|
using Darkmatter.Core.Data.Signals.Features.ShapeBuilder;
|
||||||
using Darkmatter.Core.Enums.Features.Progression;
|
using Darkmatter.Core.Enums.Features.Progression;
|
||||||
using Darkmatter.Core.Enums.Services.Scenes;
|
using Darkmatter.Core.Enums.Services.Scenes;
|
||||||
@@ -109,8 +110,8 @@ namespace Darkmatter.Features.GameplayFlow.Systems
|
|||||||
_loadingScreen.Show();
|
_loadingScreen.Show();
|
||||||
_shapeBuilder.Clear();
|
_shapeBuilder.Clear();
|
||||||
_coloring.Clear();
|
_coloring.Clear();
|
||||||
await _scenes.LoadSceneAsync(GameScene.Colorbook, progress: null, cancellationToken: ct);
|
await _scenes.LoadSceneAsync(nameof(GameScene.Colorbook), progress: null, cancellationToken: ct);
|
||||||
await _scenes.UnloadSceneAsync(GameScene.Gameplay, progress: null, cancellationToken: ct);
|
await _scenes.UnloadSceneAsync(nameof(GameScene.Gameplay), progress: null, cancellationToken: ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async UniTask SaveAsync(CancellationToken ct)
|
public async UniTask SaveAsync(CancellationToken ct)
|
||||||
@@ -131,15 +132,17 @@ namespace Darkmatter.Features.GameplayFlow.Systems
|
|||||||
_loadingScreen.Show();
|
_loadingScreen.Show();
|
||||||
_shapeBuilder.Clear();
|
_shapeBuilder.Clear();
|
||||||
_coloring.Clear();
|
_coloring.Clear();
|
||||||
await _scenes.LoadSceneAsync(GameScene.Colorbook, progress: null, cancellationToken: default);
|
await _scenes.LoadSceneAsync(nameof(GameScene.Colorbook), progress: null, cancellationToken: default);
|
||||||
await _scenes.UnloadSceneAsync(GameScene.Gameplay, progress: null, cancellationToken: default);
|
await _scenes.UnloadSceneAsync(nameof(GameScene.Gameplay), progress: null, cancellationToken: default);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await _progression.SetLastOpenedAsync(nextId);
|
_loadingScreen.Show();
|
||||||
_shapeBuilder.Clear();
|
_shapeBuilder.Clear();
|
||||||
_coloring.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()
|
public void OnApplicationPaused()
|
||||||
|
|||||||
BIN
Assets/Darkmatter/Content/.DS_Store
vendored
Normal file
BIN
Assets/Darkmatter/Content/.DS_Store
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user