예제 #1
0
        public override void InstallBindings()
        {
            // Unit Spawning UI. This is injected here because the dependency graph is local to unit spawning.
            Container.Bind <IUnitSpawnViewController>().To <UnitSpawnViewController>()
            .FromComponentInNewPrefab(_unitPickerVcPrefab)
            .AsSingle()
            .Lazy();

            // Unit Pool
            // NOTE: We do not use UnderTransformGroup because there is an issue with parenting under a
            // transform with a given name when switching scenes.
            // We should use UnderTransform instead, but that requires a specific Transform reference.
            Container.BindMemoryPool <UnitRenderer, UnitRenderer.Pool>()
            .WithInitialSize(10)
            .FromComponentInNewPrefab(_unitPrefab)
            .WhenInjectedInto <UnitPool>();

            Container.Bind <IUnitPool>().To <UnitPool>().AsSingle();
            // Maybe use identifiers? random number?
            Container.Bind <IMutableUnitRegistry>().To <UnitRegistry>().FromResolve().WhenInjectedInto <UnitPool>();

            // Bind lifecycle to the UnitsSpawners
            Container.BindInterfacesTo <PlayerUnitSpawner>().AsSingle();
            Container.BindInterfacesTo <InitialUnitSpawner>().AsSingle();

            // Settings
            Container.Bind <IUnitSpawnSettings>().To <UnitSpawnSettings>().FromInstance(_unitSpawnSettings).AsSingle();

            // Commands installer
            CommandsInstaller.Install <SpawnUnitCommandsInstaller>(Container);
        }
        public override void InstallBindings()
        {
            Container.Bind <MapSectionSelectionViewController>()
            .FromComponentInNewPrefab(_mapSelectionViewController)
            .AsSingle()
            .NonLazy();
            Container.Bind <IMapSectionEntryTileFinder>().To <MapSectionEntryTileFinder>().AsSingle();

            CommandsInstaller.Install <MapSectionsCommandsInstaller>(Container);
        }
예제 #3
0
        public override void InstallBindings()
        {
            Container.Bind(typeof(IGridUnitManager), typeof(IInitializable)).To <GridUnitManager>().AsSingle();
            Container.Bind <IGridUnitInputManager>().To <GridUnitInputManager>().AsSingle();

            // GridUnitManager should be the only thing mutating the unit transform.
            Container.Bind <IUnitTransformRegistry>().To <UnitRegistry>().FromResolve().WhenInjectedInto <GridUnitManager>();

            // Commands should only be related to units in Grid.
            CommandsInstaller.Install <GridUnitCommandsInstaller>(Container);
        }
예제 #4
0
        public override void InstallBindings()
        {
            Container.BindInterfacesTo <DrawingInputManager>().AsSingle();
            Container.Bind <IDrawableTileRegistry>().To <DrawableTileRegistry>().AsSingle();

            Container.BindMemoryPool <DrawableTileBehaviour, DrawableTileBehaviour.Pool>()
            .WithInitialSize(5)
            .FromComponentInNewPrefab(_drawableTilePrefab)
            .UnderTransformGroup("DrawableTiles");

            // Commands
            CommandsInstaller.Install <DrawingCommandsInstaller>(Container);
        }
        public override void InstallBindings()
        {
            for (uint i = 0; i < _mapSelectionData.mapReferences.Length; i++)
            {
                var mapReference = _mapSelectionData.mapReferences[i];
                Container.Bind <IMapReference>()
                .To <AddressableAssetMapReference>()
                .FromInstance(mapReference);

                mapReference.MapStoreId = new MapStoreId(i);
                Container.Bind <AddressableAssetMapReference>()
                .FromInstance(mapReference)
                .WhenInjectedInto <AddressableAssetMapDataStore>();
            }
            Container.Bind <IMapDataStore>()
            .To <AddressableAssetMapDataStore>()
            .AsSingle()
            .WhenInjectedInto(typeof(LoadMapCommand), typeof(MapEditorInstaller));

            CommandsInstaller.Install <MapDataStoreCommandsInstaller>(Container);
        }