fixess
This commit is contained in:
@@ -23,6 +23,7 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
|
|||||||
private readonly IEventBus _bus;
|
private readonly IEventBus _bus;
|
||||||
|
|
||||||
private IDisposable _selectedSub;
|
private IDisposable _selectedSub;
|
||||||
|
private IDisposable _returnToMainMenuSubscription;
|
||||||
|
|
||||||
public ColorbookFlowController(
|
public ColorbookFlowController(
|
||||||
IDrawingCatalogController drawingCatalog,
|
IDrawingCatalogController drawingCatalog,
|
||||||
@@ -40,12 +41,27 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
|
|||||||
|
|
||||||
public async UniTask StartAsync(CancellationToken cancellation = new CancellationToken())
|
public async UniTask StartAsync(CancellationToken cancellation = new CancellationToken())
|
||||||
{
|
{
|
||||||
_returnToMainMenuSubscription = _eventBus.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);
|
_selectedSub = _bus.Subscribe<DrawingSelectedSignal>(OnDrawingSelected);
|
||||||
_loadingScreen.Hide();
|
_loadingScreen.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnReturnToMainMenu(ReturnToMainMenuSignal signal)
|
||||||
|
{
|
||||||
|
LoadMainMenuSceneAsync().Forget(UnityEngine.Debug.LogException);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async UniTask LoadMainMenuSceneAsync(CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
_loadingScreen.Show();
|
||||||
|
var progress = new Progress<float>(p => _loadingScreen.SetProgress(p * 0.5f));
|
||||||
|
await _scenes.LoadSceneAsync(nameof(GameScene.MainMenu), progress, ct);
|
||||||
|
var mappedProgress = new Progress<float>(p => _loadingScreen.SetProgress(0.5f + p * 0.25f));
|
||||||
|
await _scenes.UnloadSceneAsync(nameof(GameScene.Colorbook), mappedProgress, ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnDrawingSelected(DrawingSelectedSignal signal)
|
private void OnDrawingSelected(DrawingSelectedSignal signal)
|
||||||
{
|
{
|
||||||
@@ -61,5 +77,6 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_selectedSub?.Dispose();
|
_selectedSub?.Dispose();
|
||||||
|
_returnToMainMenuSubscription?.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user