Danro-Jump/Assets/Scripts/Runtime/Settings/Installers/ServiceSettingsInstaller.cs
Danil Iarosh 77186697f8 Prepare v0.1 gameplay and hardware foundation
Подробные изменения:

- Расширен основной gameplay loop: джетпак, новые платформы, оборудование, враги, прогрессия сложности и ограничения взаимодействий игрока.

- Добавлены Bootstrap-сервисы запуска приложения, защита, фокус окна, управление курсором и настройки сервисов через DI.

- Добавлена COM-интеграция с технической схемой Input System, обработкой кнопок/ADC, подсветкой и консольной диагностикой.

- Добавлен отдельный debug/logging модуль с каналами, обработчиками консоли и файловым выводом.

- Добавлены asmdef, link.xml, EditMode/PlayMode тесты и обновлена дорожная карта проекта.

Проверки:

- dotnet build .\\DanroJump.Runtime.csproj --no-restore

- dotnet build .\\DanroJump.Tests.EditMode.csproj --no-restore

- dotnet build .\\DanroJump.Tests.PlayMode.csproj --no-restore
2026-06-08 14:22:48 +03:00

53 lines
2.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
using Zenject;
using DanroJump.SceneFlow;
namespace DanroJump.Settings
{
/// <summary>
/// ProjectContext/SceneContext installer сервисных настроек.
/// </summary>
public sealed class ServiceSettingsInstaller : MonoInstaller
{
[SerializeField] private string databaseAddress = ServiceSettingsAddressKeys.Database;
[SerializeField] private ServiceSettingsDatabase fallbackDatabase;
[SerializeField] private string fileName = "service-settings.json";
[SerializeField] private bool loadImmediately = true;
[SerializeField] private bool bindActionsInScene = true;
/// <summary>
/// Загружает базу настроек, создает сервис и регистрирует его в DI-контейнере.
/// </summary>
public override void InstallBindings()
{
var databaseProvider = new AddressableServiceSettingsDatabaseProvider(databaseAddress, fallbackDatabase);
var database = databaseProvider.Load();
if (database == null)
{
Debug.LogError($"{nameof(ServiceSettingsInstaller)} could not load {nameof(ServiceSettingsDatabase)}.", this);
databaseProvider.Dispose();
Container.BindInterfacesAndSelfTo<SceneFlowService>().AsSingle();
return;
}
var repository = new JsonServiceSettingsRepository(fileName);
var service = new ServiceSettingsService(database, repository);
if (loadImmediately)
{
service.Load();
}
Container.BindInstance(database).AsSingle();
Container.Bind<IServiceSettingsDatabaseProvider>().FromInstance(databaseProvider).AsSingle();
Container.Bind<System.IDisposable>().FromInstance(databaseProvider).AsSingle();
Container.Bind<IServiceSettingsRepository>().FromInstance(repository).AsSingle();
Container.Bind<IReadOnlyServiceSettings>().FromInstance(service).AsSingle();
Container.Bind<IServiceSettingsService>().FromInstance(service).AsSingle();
Container.BindInterfacesAndSelfTo<SceneFlowService>().AsSingle();
Container.BindInterfacesTo<ServiceSettingsSceneInjector>().AsSingle().WithArguments(bindActionsInScene).NonLazy();
}
}
}