37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using Code.Example.Race;
|
|
using Code.Example.Race.Racer;
|
|
using Code.Example.Race.Track;
|
|
using Code.Infrastructure.SceneLoader;
|
|
using Reflex.Core;
|
|
using Reflex.Enums;
|
|
using UnityEngine;
|
|
using Resolution = Reflex.Enums.Resolution;
|
|
|
|
namespace Code.Infrastructure.App.SceneInstallers
|
|
{
|
|
public class GameplaySceneInstaller : MonoBehaviour, IInstaller
|
|
{
|
|
[SerializeField] private RaceTrackData raceTrackData;
|
|
|
|
public void InstallBindings(ContainerBuilder containerBuilder)
|
|
{
|
|
containerBuilder.RegisterType(typeof(RacerFactory), new[] { typeof(IRacerFactory) }, Lifetime.Scoped,
|
|
Resolution.Lazy);
|
|
containerBuilder.RegisterType(typeof(RaceScores), Lifetime.Scoped,
|
|
Resolution.Eager);
|
|
containerBuilder.RegisterValue(raceTrackData);
|
|
containerBuilder.RegisterType(typeof(RaceGame), Lifetime.Scoped,
|
|
Resolution.Lazy);
|
|
containerBuilder.RegisterType(typeof(PlayerPrefsRacePoopshitter), Lifetime.Scoped,
|
|
Resolution.Lazy);
|
|
|
|
containerBuilder.OnContainerBuilt += PostInstall;
|
|
}
|
|
|
|
private void PostInstall(Container container)
|
|
{
|
|
container.Resolve<EventBus.EventBus>()
|
|
.RaiseEvent<IOnGameplaySceneLoadedHandler>(x => x.OnGameplaySceneInitialized(container));
|
|
}
|
|
}
|
|
} |