work_branch #12

Merged
savya merged 5 commits from work_branch into main 2026-05-29 06:52:40 +02:00
3 changed files with 1327 additions and 19 deletions
Showing only changes of commit a51a73efdd - Show all commits

View File

@@ -23,6 +23,7 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
private readonly IEventBus _bus;
private IDisposable _selectedSub;
private IDisposable _returnToMainMenuSubscription;
public ColorbookFlowController(
IDrawingCatalogController drawingCatalog,
@@ -40,12 +41,27 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
public async UniTask StartAsync(CancellationToken cancellation = new CancellationToken())
{
_returnToMainMenuSubscription = _eventBus.Subscribe<ReturnToMainMenuSignal>(OnReturnToMainMenu);
_returnToMainMenuSubscription = _bus.Subscribe<ReturnToMainMenuSignal>(OnReturnToMainMenu);
_loadingScreen.SetProgress(1f);
await _drawingCatalog.InitializeAsync(cancellation);
_selectedSub = _bus.Subscribe<DrawingSelectedSignal>(OnDrawingSelected);
_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)
{
@@ -61,5 +77,6 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
public void 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