Exemple #1
0
        public static void BindInterface(DiContainer container, DiContainer subContainer)
        {
            container.BindInterfacesTo <AuthController>()
            .FromSubContainerResolve()
            .ByInstance(subContainer)
            .AsSingle();

            container.BindInterfacesTo <DataFetchController>()
            .FromSubContainerResolve()
            .ByInstance(subContainer)
            .AsSingle();

            container.BindInterfacesTo <DataValidateController>()
            .FromSubContainerResolve()
            .ByInstance(subContainer)
            .AsSingle();

            container.BindInterfacesTo <AppForceUpdateController>()
            .FromSubContainerResolve()
            .ByInstance(subContainer)
            .AsSingle();

            container.BindInterfacesTo <AppMaintenanceController>()
            .FromSubContainerResolve()
            .ByInstance(subContainer)
            .AsSingle();
        }
        public static void BindInterface(DiContainer container, DiContainer subContainer)
        {
            container.BindInterfacesTo <AssetLoader>()
            .FromSubContainerResolve()
            .ByInstance(subContainer)
            .AsSingle();

            container.BindInterfacesTo <ContentCatalogLoader>()
            .FromSubContainerResolve()
            .ByInstance(subContainer)
            .AsSingle();
        }
Exemple #3
0
        private void InstallBindingsToSubContainer(DiContainer subContainer)
        {
            subContainer.BindInstance(new InitialState(ShouldRenderInitialValue, InitialValue)).AsCached();
            subContainer.BindInterfacesTo <NumberRendererUseCase>().AsCached();
            subContainer.BindInterfacesTo <InitializationController>().AsCached();
            switch (RendererType)
            {
            case RendererType.SpriteRenderer:
                subContainer.BindInterfacesTo <NumberRenderingPresenter <SpriteRenderer, Sprite> >().AsCached();
                subContainer.BindInterfacesTo <NumberRendererForSpriteRenderer>().FromNewComponentOn(gameObject).AsCached();
                subContainer.Bind <IList <SpriteRenderer> >().FromInstance(Renderers.Select(x => x.GetComponent <SpriteRenderer>()).ToList()).AsCached();
                subContainer.BindInstance(Sprites).AsCached();
                break;

            case RendererType.UIImage:
                subContainer.BindInterfacesTo <NumberRenderingPresenter <Image, Sprite> >().AsCached();
                subContainer.BindInterfacesTo <NumberRendererForUIImage>().FromNewComponentOn(gameObject).AsCached();
                subContainer.Bind <IList <Image> >().FromInstance(Renderers.Select(x => x.GetComponent <Image>()).ToList()).AsCached();
                subContainer.BindInstance(Sprites).AsCached();
                break;

            case RendererType.UIRawImage:
                subContainer.BindInterfacesTo <NumberRenderingPresenter <RawImage, Texture> >().AsCached();
                subContainer.BindInterfacesTo <NumberRendererForUIRawImage>().FromNewComponentOn(gameObject).AsCached();
                subContainer.Bind <IList <RawImage> >().FromInstance(Renderers.Select(x => x.GetComponent <RawImage>()).ToList()).AsCached();
                subContainer.BindInstance(Textures).AsCached();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            subContainer.BindInstance(EmptyDigitType).AsCached();
            subContainer.BindInstance(ShouldRenderInitialValue).AsCached();
            subContainer.BindInstance(InitialValue).AsCached();
        }
 private void BindPhotonNetworkManager(DiContainer container)
 {
     container.Bind <PhotonNetworkManager>().AsSingle();
     container.BindInterfacesTo <PhotonRoomHandler>().AsSingle();
     container.Bind <IPhotonNetworkConnector>().To <PhotonNetworkConnector>().AsSingle();
     container.Bind <ServerSettings>().FromResources("PhotonServerSettings").AsSingle();
 }
Exemple #5
0
 private static void InstallWithMemory(DiContainer container)
 {
     InstallHandler(container);
     container
     .BindInterfacesTo <Memory>()
     .AsCached();
 }
Exemple #6
0
 private static void InstallWithPlayerPrefs(DiContainer container)
 {
     InstallHandler(container);
     container
     .BindInterfacesTo <PlayerPrefs>()
     .AsCached();
 }
Exemple #7
0
 private static void RegisterSignal <T>(DiContainer container) where T : ISignalBase
 {
     // why must we have 2 lines to make these things work?
     // Note: if you only BindSignal you get some weird null exception error
     container.DeclareSignal <T>();
     container.BindInterfacesTo <T>().AsSingle();
 }
Exemple #8
0
 public static void BindSingleSavegame <T, T2>(this DiContainer container, T2 savegameData)
     where T : ISavegame
     where T2 : ISavegameData
 {
     container.BindInterfacesTo <T>()
     .AsSingle()
     .WithArguments(savegameData);
 }
Exemple #9
0
        public static void InstallBindingsCore(DiContainer container)
        {
            // domain.
            container.BindInterfacesTo <SceneManager>().AsCached();

            // presentation.
            container.BindExecutionOrder <GameTimer>(-1000000);
            container.BindInterfacesTo <GameTimer>().AsCached();

            // data.
            container.BindInterfacesTo <FileSave>().AsCached().WithArguments(Application.temporaryCachePath);
            container.Bind <CacheUserStore>().AsCached();
            container.Bind <UserStore>().AsCached();
            container.Bind <UserTranslator>().AsCached();
            container.Bind <HiScoreTranslator>().AsCached();

            // test.
            container.BindUseCase <TestUserUseCase, TestUserUseCaseFactory, TestUserUseCase.IFactory>();
            container.BindRepository <TestUserRepository>();
            container.Bind <TestUserNameStore>().AsCached();
        }
        public override void Install(DiContainer container)
        {
            container
            .BindInterfacesTo <MmfBasedMessageIo>()
            .AsCached();

            container
            .Bind <ErrorIndicateSender>()
            .AsCached();

            container
            .Bind <ErrorInfoFactory>()
            .AsCached();
        }
Exemple #11
0
        void InstallBindings(List <MonoBehaviour> injectableMonoBehaviours)
        {
            _container.Bind(typeof(Context), typeof(SceneContext)).To <SceneContext>().FromInstance(this);
            _container.BindInterfacesTo <SceneContextRegistryAdderAndRemover>().AsSingle();

            // Add to registry first and remove from registry last
            _container.BindExecutionOrder <SceneContextRegistryAdderAndRemover>(-1);

            foreach (var decoratorContext in _decoratorContexts)
            {
                decoratorContext.InstallDecoratorSceneBindings();
            }

            InstallSceneBindings(injectableMonoBehaviours);

            _container.Bind(typeof(SceneKernel), typeof(MonoKernel))
            .To <SceneKernel>().FromNewComponentOn(gameObject).AsSingle().NonLazy();

            _container.Bind <ZenjectSceneLoader>().AsSingle();

            if (ExtraBindingsInstallMethod != null)
            {
                ExtraBindingsInstallMethod(_container);
                // Reset extra bindings for next time we change scenes
                ExtraBindingsInstallMethod = null;
            }

            // Always install the installers last so they can be injected with
            // everything above
            foreach (var decoratorContext in _decoratorContexts)
            {
                decoratorContext.InstallDecoratorInstallers();
            }

            InstallInstallers();

            foreach (var decoratorContext in _decoratorContexts)
            {
                decoratorContext.InstallLateDecoratorInstallers();
            }

            if (ExtraBindingsLateInstallMethod != null)
            {
                ExtraBindingsLateInstallMethod(_container);
                // Reset extra bindings for next time we change scenes
                ExtraBindingsLateInstallMethod = null;
            }
        }
Exemple #12
0
 private static void InstallHandler(DiContainer container)
 {
     container
     .BindInterfacesTo <KeyValueStoreHandler>()
     .AsCached();
 }
 public static ConcreteIdArgConditionCopyNonLazyBinder BindRepository <TRepository>(this DiContainer container) where TRepository : RepositoryBase
 {
     return(container.BindInterfacesTo <TRepository>().AsTransient());
 }
 public void InstallBindings(DiContainer container)
 {
     container.BindInterfacesTo <InputController>().AsSingle();
 }
 public override void Install(DiContainer container)
 {
     container
     .BindInterfacesTo <MmfBasedMessageIo>()
     .AsCached();
 }