/
GeekNerd
/
ServerModelingProject
Обзор
Документация
Войти
/
GeekNerd
/
ServerModelingProject
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Assets/Scripts/UI_Logic/RoomBuildingPart/Buttons/Controllers/DoneButtonController.cs
66 строк
2 KB
Gorney-Alex
Init
30 май 2026, 19:05
30 май 2026, 19:05
3cdcc49
Код
Авторство
О чём код?
using System; using App; using DataClasses; using RoomBuilding; using UI_Logic.Buttons; using Zenject; namespace UI_Logic.RoomBuildingPart.Buttons.Controllers { public class DoneButtonController : IInitializable, IDisposable { private readonly DoneButtonView _view; private readonly PolygonDrawingService _drawingService; private readonly ProjectService _projectService; private readonly RoomBuildingStatusView _statusView; private readonly AppLauncher _appLauncher; public DoneButtonController( DoneButtonView view, PolygonDrawingService drawingService, ProjectService projectService, RoomBuildingStatusView statusView, AppLauncher appLauncher) { _view = view; _drawingService = drawingService; _projectService = projectService; _statusView = statusView; _appLauncher = appLauncher; } public void Initialize() { _view.GetButton().onClick.AddListener(Pressed); _drawingService.OnRoomBuilt += OnRoomBuilt; _drawingService.OnError += OnError; } public void Dispose() { if (_view as UnityEngine.Object == null) return; _view.GetButton().onClick.RemoveListener(Pressed); _drawingService.OnRoomBuilt -= OnRoomBuilt; _drawingService.OnError -= OnError; } private void Pressed() { _drawingService.TryFinish(); } private void OnRoomBuilt(RoomConfig config) { _projectService.SaveData(config, "room_config"); _statusView?.ShowMessage("The room is saved"); _appLauncher.StartEquipmentPlacementScene(); } private void OnError(string error) { _statusView?.ShowError(error); } } }