fda094dd44
- 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 на основе значения прогресса для визуальной обратной связи
46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|