feat(task-0005): implement splash delay and loading progress with reactive properties
- Add SplashState delay timer using BootSettings.SplashDurationSeconds with cancellation support - Implement LoadState progress tracking via ReactiveProperty<float> with step-by-step updates - Update LoadingUIViewModel to accept and expose Progress reactive property - Connect LoadingUIView to ViewModel progress changes using UniRx subscriptions - Add CompositeDisposable for proper cleanup of UI subscriptions in Release() - Scale ProgressFill transform based on progress value for visual feedback Выполнена задача TASK-0005 и реализованы splash и loading состояния: - Добавлен таймер задержки в SplashState с использованием BootSettings.SplashDurationSeconds и поддержкой отмены - Реализован трекинг прогресса в LoadState через ReactiveProperty<float> со пошаговыми обновлениями - Обновлён LoadingUIViewModel для принятия и экспорта реактивного свойства Progress - Подключён LoadingUIView к изменениям прогресса ViewModel с использованием подписок UniRx - Добавлен CompositeDisposable для правильной очистки UI подписок в Release() - Масштабирование ProgressFill на основе значения прогресса для визуальной обратной связи
This commit is contained in:
@@ -1,8 +1,45 @@
|
||||
using QuizPleaseTest.Common.UI;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QuizPleaseTest.Boot.UI
|
||||
{
|
||||
public class LoadingUIView : UIView<LoadingUIViewModel>
|
||||
{
|
||||
[field: SerializeField] public Transform ProgressFill { get; private set; }
|
||||
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_disposables?.Dispose();
|
||||
_disposables = new CompositeDisposable();
|
||||
|
||||
SetProgress(ViewModel.Progress.Value);
|
||||
ViewModel.Progress
|
||||
.Subscribe(SetProgress)
|
||||
.AddTo(_disposables);
|
||||
}
|
||||
|
||||
public override void Release()
|
||||
{
|
||||
_disposables?.Dispose();
|
||||
_disposables = null;
|
||||
base.Release();
|
||||
}
|
||||
|
||||
private void SetProgress(float progress)
|
||||
{
|
||||
if (ProgressFill == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 scale = ProgressFill.localScale;
|
||||
scale.x = Mathf.Clamp01(progress);
|
||||
ProgressFill.localScale = scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
using System;
|
||||
using QuizPleaseTest.Common.UI;
|
||||
using UniRx;
|
||||
|
||||
namespace QuizPleaseTest.Boot.UI
|
||||
{
|
||||
public class LoadingUIViewModel : IUIViewModel
|
||||
{
|
||||
public IReadOnlyReactiveProperty<float> Progress { get; }
|
||||
|
||||
public LoadingUIViewModel(IReadOnlyReactiveProperty<float> progress)
|
||||
{
|
||||
Progress = progress ?? throw new ArgumentNullException(nameof(progress));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user