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(); }
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(); }
private static void InstallWithMemory(DiContainer container) { InstallHandler(container); container .BindInterfacesTo <Memory>() .AsCached(); }
private static void InstallWithPlayerPrefs(DiContainer container) { InstallHandler(container); container .BindInterfacesTo <PlayerPrefs>() .AsCached(); }
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(); }
public static void BindSingleSavegame <T, T2>(this DiContainer container, T2 savegameData) where T : ISavegame where T2 : ISavegameData { container.BindInterfacesTo <T>() .AsSingle() .WithArguments(savegameData); }
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(); }
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; } }
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(); }