6601c8ea22
- Update MenuUIViewModel with IMenuRestartSignal dependency and Restart() method - Add RestartButton to MenuUIView with listener management in Initialize/Release - Connect MenuUIView click handler to ViewModel.Restart() callback - Fix race condition in MenuRestartSignal.RequestRestart() by nulling completion source first - Wrap MenuState.WaitAsync() in try-catch for proper view cleanup on cancellation - Update TASK-0006 status to Ready Выполнена задача TASK-0006: реализована кнопка Restart и координация сигналов - Обновлён MenuUIViewModel с зависимостью IMenuRestartSignal и методом Restart() - Добавлена кнопка RestartButton в MenuUIView с управлением слушателями в Initialize/Release - Подключен обработчик кликов MenuUIView к колбэку ViewModel.Restart() - Исправлено состояние гонки в MenuRestartSignal.RequestRestart() путем обнуления completion source - Обёрнут WaitAsync в MenuState в try-catch для корректной очистки view при отмене - Обновлён статус TASK-0006 до Ready
40 lines
901 B
C#
40 lines
901 B
C#
using QuizPleaseTest.Common.UI;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace QuizPleaseTest.Boot.UI
|
|
{
|
|
public class MenuUIView : UIView<MenuUIViewModel>
|
|
{
|
|
[field: SerializeField] public Button RestartButton { get; private set; }
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
if (RestartButton == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
RestartButton.onClick.RemoveListener(OnRestartClicked);
|
|
RestartButton.onClick.AddListener(OnRestartClicked);
|
|
}
|
|
|
|
public override void Release()
|
|
{
|
|
if (RestartButton != null)
|
|
{
|
|
RestartButton.onClick.RemoveListener(OnRestartClicked);
|
|
}
|
|
|
|
base.Release();
|
|
}
|
|
|
|
private void OnRestartClicked()
|
|
{
|
|
ViewModel.Restart();
|
|
}
|
|
}
|
|
}
|