Ejemplo n.º 1
0
 public void Setup(IDependencyContainer container)
 {
     container.Bind <HttpManager>();
     container.Bind <SocketManager>();
     container.Bind <IHttpProtocol, DefaultHttpProtocol>();
     container.Bind <ISocketProtocol, SocketProtocol>();
 }
Ejemplo n.º 2
0
 public void Setup(IDependencyContainer container)
 {
     container.Unbind <IUpdateScheduler>();
     container.Bind <IUpdateScheduler>(x => x.ToInstance(_gameContext));
     container.Bind <IGameScheduler>(x => x.ToInstance(_gameContext));
     container.Bind <IBytech>(x => x.ToInstance(_gameContext.Bytech));
 }
Ejemplo n.º 3
0
 public void SetupDependencies(IDependencyContainer container)
 {
     container.Bind <IConventionalSystemHandler, ReactToEntitySystemHandler>();
     container.Bind <IConventionalSystemHandler, ReactToGroupSystemHandler>();
     container.Bind <IConventionalSystemHandler, ReactToDataSystemHandler>();
     container.Bind <IConventionalSystemHandler, SetupSystemHandler>();
     container.Bind <IConventionalSystemHandler, TeardownSystemHandler>();
 }
 /// <inheritdoc />
 public void Setup(IDependencyContainer container)
 {
     container.Bind <ApplePickupSoundCollection>();
     container.Bind <FootStepSoundCollection>();
     container.Bind <PlayerAttackSoundCollection>();
     container.Bind <PrefabCollection>();
     container.Bind <SodaPickupSoundCollection>();
 }
Ejemplo n.º 5
0
        public void Setup(IDependencyContainer container)
        {
            var graphics = new GraphicsManager(_gameContext.Bytech, _gameContext);

            container.Unbind <IUpdateScheduler>();
            container.Bind <IUpdateScheduler>(x => x.ToInstance(_gameContext));
            container.Bind <IGameScheduler>(x => x.ToInstance(_gameContext));
            container.Bind <IBytech>(x => x.ToInstance(_gameContext.Bytech));
            container.Bind <IGraphics>(x => x.ToInstance(graphics));
        }
Ejemplo n.º 6
0
        public void Setup(IDependencyContainer container)
        {
            // By default only the binary stuff is loaded, but you can load json, yaml, bson etc
            container.Bind <IJsonPrimitiveHandler, BasicJsonPrimitiveHandler>();
            container.Bind <IJsonSerializer, JsonSerializer>();
            container.Bind <IJsonDeserializer, JsonDeserializer>();

            // Register our custom pipeline using the json stuff above
            container.Bind <PostJsonHttpPipeline>();
        }
Ejemplo n.º 7
0
        public void Register(IDependencyContainer container)
        {
            // Bind the Service Identity Provider
            container.Bind <IServiceIdentityProvider, ApplicationServiceIdentityProvider>();

            // Bind the Service Authorization Policy
            container.Bind <IServiceAuthorizationPolicy, ApplicationServiceAuthorizationPolicy>();

            container.Bind <EmailNotificationService, EmailNotificationService>();
        }
Ejemplo n.º 8
0
        public void Setup(IDependencyContainer container)
        {
            container.Bind <HttpManager>();
            container.Bind <SocketManager>();
            container.Bind <IHttpProtocol, HttpProtocol>();
            container.Bind <ISocketProtocol, SocketProtocol>();
            var zenjectContainer = container.NativeContainer as DiContainer;

            zenjectContainer.BindFactory <string, int, IHttpRequest, HttpRequestFactory>().To <HttpRequest>();
            zenjectContainer.BindFactory <string, int, SocketChannel, SocketChannel.Factory>();
        }
Ejemplo n.º 9
0
        public void Setup(IDependencyContainer container)
        {
            container.Bind <ILoadStrategy, LocalPriorLoadStrategy>();
            container.Bind <LocalFileLoader>();
            container.Bind <RemoteFileLoader>();
            container.Bind <ImageLoader>();
            container.Bind <IResourceLoader, ResourceLoader>();

            var zenjectContainer = container.NativeContainer as DiContainer;

            zenjectContainer.Bind <IResourceLoader>().WithId("AssetBundle").To <AssetBundleLoader>().AsSingle();
        }
Ejemplo n.º 10
0
        public void Setup(IDependencyContainer container)
        {
            // Override our default save pipeline (binary ones) with the json one
            container.Unbind <ISaveEntityDatabasePipeline>();
            container.Bind <ISaveEntityDatabasePipeline>(builder =>
                                                         builder.ToMethod(CreateJsonSavePipeline).AsSingleton());

            // Override our default load pipeline (binary ones) with the json one
            container.Unbind <ILoadEntityDatabasePipeline>();
            container.Bind <ILoadEntityDatabasePipeline>(builder =>
                                                         builder.ToMethod(CreateJsonLoadPipeline).AsSingleton());
        }
Ejemplo n.º 11
0
        public void Setup(IDependencyContainer container)
        {
            // For this one lets tell LazyData how to handle numeric types
            // For more info on this stuff look at the LazyData project docs
            container.Bind <IPrimitiveChecker, NumericsPrimitiveChecker>();

            // Tell it how to handle objects in System.Numerics in json world
            container.Bind <IJsonPrimitiveHandler, NumericsJsonPrimitiveHandler>();
            container.Bind <IJsonPrimitiveHandler, BasicJsonPrimitiveHandler>();

            // Dont need this, but just showing how you load the numerics handler for binary formats
            container.Bind <IBinaryPrimitiveHandler, NumericsBinaryPrimitiveHandler>();
        }
Ejemplo n.º 12
0
 public void Setup(IDependencyContainer container)
 {
     container.Bind <IIdPool, IdPool>();
     container.Bind <IEntityFactory, DefaultEntityFactory>();
     container.Bind <IEntityCollectionFactory, DefaultEntityCollectionFactory>();
     container.Bind <IEntityDatabase, EntityDatabase>();
     container.Bind <IObservableGroupFactory, DefaultObservableObservableGroupFactory>();
     container.Bind <IObservableGroupManager, ObservableGroupManager>();
     container.Bind <IConventionalSystemHandler, BasicEntitySystemHandler>();
     container.Bind <IComponentTypeAssigner, DefaultComponentTypeAssigner>();
     container.Bind <IComponentTypeLookup>(new BindingConfiguration {
         ToMethod = CreateDefaultTypeLookup
     });
     container.Bind <IComponentDatabase, ComponentDatabase>();
 }
Ejemplo n.º 13
0
 public void Setup(IDependencyContainer container)
 {
     container.Bind <IMessageBroker, MessageBroker>();
     container.Bind <IEventSystem, EventSystem>();
     container.Bind <IThreadHandler, DefaultThreadHandler>();
     container.Bind <IConventionalSystemHandler, ManualSystemHandler>();
     container.Bind <IConventionalSystemHandler, BasicSystemHandler>();
     container.Bind <IConventionalSystemHandler, ReactToEventSystemHandler>();
     container.Bind <ISystemExecutor, SystemExecutor>();
     container.Bind <IUpdateScheduler, DefaultUpdateScheduler>();
     container.Bind <ITimeTracker>(x => x.ToBoundType(typeof(IUpdateScheduler)));
 }
Ejemplo n.º 14
0
 public void Setup(IDependencyContainer container)
 {
     container.Bind <IAbilityHandlerRepository, AbilityHandlerRepository>();
     container.Bind <ISpellHandlerRepository, SpellHandlerRepository>();
     container.Bind <ICardEffectsRepository, CardEffectsRepository>(x => x.WithConstructorArg(new CardEffectsDataLoader().LoadData()));
     container.Bind <IRaceTemplateRepository, RaceTemplateRepository>(x => x.WithConstructorArg(new RaceTemplateDataLoader().LoadData()));
     container.Bind <IClassTemplateRepository, ClassTemplateRepository>(x => x.WithConstructorArg(new ClassTemplateDataLoader().LoadData()));
     container.Bind <IItemTemplateRepository, ItemTemplateRepository>(x => x.WithConstructorArg(new ItemTemplateDataLoader().LoadData()));
     container.Bind <IAbilityRepository, AbilityRepository>(x => x.WithConstructorArg(new AbilityDataLoader().LoadData()));
     container.Bind <ITimedEffectRepository, TimedEffectRepository>(x => x.WithConstructorArg(new TimedEffectDataLoader().LoadData()));
     container.Bind <ISpellRepository, SpellRepository>();
 }
Ejemplo n.º 15
0
        public void Setup(IDependencyContainer container)
        {
            var namedHealthGroup    = container.ResolveObservableGroup(new Group(typeof(HasHealthComponent), typeof(HasNameComponent)));
            var computedHealthGroup = new LowestHealthComputedGroup(namedHealthGroup);

            container.Bind <ILowestHealthComputedGroup>(x => x.ToInstance(computedHealthGroup));
        }
Ejemplo n.º 16
0
 public void Setup(IDependencyContainer container)
 {
     if (container.HasBinding <IF_VR_IGrabStatus>())
     {
         container.Unbind <IF_VR_IGrabStatus>();
     }
     container.Bind <IF_VR_IGrabStatus, IF_VR_Glove_SteamVRManus_GrabStatus>();
 }
 public void Setup(IDependencyContainer container)
 {
     if (container.HasBinding <IF_VR_IInterface>())
     {
         container.Unbind <IF_VR_IInterface>();
     }
     container.Bind <IF_VR_IInterface, IF_VR_Steam_Interface>();
 }
Ejemplo n.º 18
0
        public override void RegisterBindings(IDependencyContainer Container)
        {
            var adapterTypes = AssemblyHelper.GetInheritancesInParentAssembly(typeof(IAdapter));

            foreach (var adapterType in adapterTypes)
            {
                Container.Bind <IAdapter>().To(adapterType).WithId(adapterType.FullName);
            }

            var viewHandlers = AssemblyHelper.GetInheritancesInParentAssembly(typeof(IViewCollectionChangedHandler));

            foreach (var viewHandler in viewHandlers)
            {
                Container.Bind <IViewCollectionChangedHandler>().To(viewHandler)
                .AsTransient().WithId(viewHandler.FullName);
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Bind using a builder for fluent configuration
        /// </summary>
        /// <param name="container">container to act on</param>
        /// <param name="builderAction">configuration handler</param>
        /// <typeparam name="TFrom">Type to bind from</typeparam>
        /// <typeparam name="TTo">Type to bind to</typeparam>
        public static void Bind <TFrom, TTo>(this IDependencyContainer container, Action <BindingBuilder> builderAction) where TTo : TFrom
        {
            var builder = new BindingBuilder();

            builderAction(builder);
            var config = builder.Build();

            container.Bind <TFrom, TTo>(config);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Bind using a builder for fluent configuration
        /// </summary>
        /// <param name="container">container to act on</param>
        /// <param name="builderAction">configuration handler</param>
        /// <typeparam name="T">Type to bind to</typeparam>
        public static void Bind <T>(this IDependencyContainer container, Action <BindingBuilder <T> > builderAction)
        {
            var builder = new BindingBuilder <T>();

            builderAction(builder);
            var config = builder.Build();

            container.Bind <T>(config);
        }
Ejemplo n.º 21
0
        public static void Bind <TType>(this IDependencyContainer container, BindingConfiguration configuration = null)
        {
            if (null == container)
            {
                throw new ArgumentNullException(nameof(container));
            }

            container.Bind(typeof(TType), configuration);
        }
Ejemplo n.º 22
0
        public void Setup(IDependencyContainer container)
        {
            container.Bind <IEcsRxGame>(x => x.ToInstance(_ecsRxGame));

            container.Unbind <IUpdateScheduler>();
            container.Bind <IUpdateScheduler>(x => x.ToInstance(_ecsRxGame));
            container.Bind <IGameScheduler>(x => x.ToInstance(_ecsRxGame));

            container.Bind <IEcsRxContentManager>(x => x.ToInstance(_ecsRxGame.EcsRxContentManager));
            container.Bind <IEcsRxSpriteBatch>(x => x.ToInstance(_ecsRxGame.EcsRxSpriteBatch));
            container.Bind <IEcsRxGraphicsDeviceManager>(x => x.ToInstance(_ecsRxGame.EcsRxGraphicsDeviceManager));
            container.Bind <IEcsRxGraphicsDevice>(x => x.ToInstance(_ecsRxGame.EcsRxGraphicsDevice));

            container.Bind <IRenderTarget2dRegistry, RenderTarget2dRegistry>();
            container.Bind <IRenderTargetCubeRegistry, RenderTargetCubeRegistry>();

            container.Bind <IConventionalSystemHandler, SpriteBatchSystemHandler>();
        }
Ejemplo n.º 23
0
 public void Setup(IDependencyContainer container)
 {
     container.Bind <IComputedPlayerPosition>(c =>
     {
         c.ToMethod(x =>
         {
             var observableGroup = x.ResolveObservableGroup(typeof(PlayerComponent));
             return(new ComputedPlayerPosition(observableGroup));
         });
     });
 }
Ejemplo n.º 24
0
        public static void Bind <TFrom, TTo>(this IDependencyContainer container,
                                             BindingConfiguration configuration = null)
            where TTo : TFrom
        {
            if (null == container)
            {
                throw new ArgumentNullException(nameof(container));
            }

            container.Bind(typeof(TFrom), typeof(TTo), configuration);
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Builds a pipeline for data
 /// </summary>
 /// <param name="container">The container to action on</param>
 /// <param name="name">The name of the pipeline</param>
 /// <param name="buildFunction">The action to build the pipeline</param>
 public static void BuildPipeline(this IDependencyContainer container, string name, Func <EcsRxPipelineBuilder, EcsRxPipelineNeedsDataBuilder> buildFunction)
 {
     container.Bind <IPipeline>(builder => builder
                                .ToMethod(x =>
     {
         var pipelineBuilder = x.Resolve <EcsRxPipelineBuilder>();
         return(buildFunction(pipelineBuilder).Build());
     })
                                .WithName(name)
                                .AsSingleton());
 }
Ejemplo n.º 26
0
        public static void Bind <TType>(this IDependencyContainer container, Action <BindingBuilder <TType> > configurator)
        {
            if (null == container)
            {
                throw new ArgumentNullException(nameof(container));
            }

            var builder = new BindingBuilder <TType>();

            configurator.Invoke(builder);
            container.Bind <TType>(builder.Build());
        }
Ejemplo n.º 27
0
        public void Setup(IDependencyContainer container)
        {
            container.Bind <IToEntityDataTransformer, ToEntityDataTransformer>();
            container.Bind <IToEntityCollectionDataTransformer, ToEntityCollectionDataTransformer>();
            container.Bind <IToEntityDatabaseDataTransformer, ToEntityDatabaseDataTransformer>();
            container.Bind <IFromEntityDataTransformer, FromEntityDataTransformer>();
            container.Bind <IFromEntityCollectionDataTransformer, FromEntityCollectionDataTransformer>();
            container.Bind <IFromEntityDatabaseDataTransformer, FromEntityDatabaseDataTransformer>();
            container.Bind <EcsRxPipelineBuilder>(builder => builder.ToMethod(x =>
                                                                              new EcsRxPipelineBuilder(x)).AsSingleton());

            // These are defaults, you can override these in your own app/plugin
            container.Bind <ISaveEntityDatabasePipeline>(builder =>
                                                         builder.ToMethod(CreateDefaultSavePipeline).AsSingleton());

            container.Bind <ILoadEntityDatabasePipeline>(builder =>
                                                         builder.ToMethod(CreateDefaultLoadPipeline).AsSingleton());
        }
Ejemplo n.º 28
0
        public void Setup(IDependencyContainer container)
        {
            container.Unbind <IComponentTypeLookup>();
            var explicitTypeLookups = new Dictionary <Type, int>
            {
                { typeof(NameComponent), ComponentLookupTypes.NameComponentId },
                { typeof(PositionComponent), ComponentLookupTypes.PositionComponentId },
                { typeof(MovementSpeedComponent), ComponentLookupTypes.MovementSpeedComponentId }
            };
            var explicitComponentLookup = new ComponentTypeLookup(explicitTypeLookups);

            container.Bind <IComponentTypeLookup>(new BindingConfiguration {
                ToInstance = explicitComponentLookup
            });
        }
Ejemplo n.º 29
0
 public void Setup(IDependencyContainer container)
 {
     container.Bind <ILoadStrategy, LocalPriorLoadStrategy>();
     container.Bind <LocalFileLoader>();
     container.Bind <RemoteFileLoader>();
     container.Bind <ImageLoader>();
     container.Bind <IResourceLoader, ResourceLoader>();
     container.Bind <IResourceLoader, AssetBundleLoader>(new BindingConfiguration {
         WithName = "AssetBundle"
     });
 }
Ejemplo n.º 30
0
        public override void RegisterBindings(IDependencyContainer Container)
        {
            // Built-in Services
            Container.Bind <IEventBroker>().To <EventBroker>().FromInstance(Her.Current.EventBroker);
            Container.Bind <ILog>().To <UnityLog>().FromInstance(Her.Current.Logger);
            Container.Bind <ITime>().To <UnityTime>().FromInstance(UnityTime.Instance);
            Container.Bind <IStore>().To <DictionaryStore>().FromInstance(DictionaryStore.Instance);
            Container.Bind <IUIStack>().FromMethod(BuildUIStackInstance);

            // View
            Container.Bind <IViewLoader>().To <ResourcesViewLoader>().FromInstance(ResourcesViewLoader.Instance);
            Container.Bind <IViewManager>().To <ViewManager>().FromInstance(ViewManager.Instance);

            // Essentials
            Container.BindAll <Her>().FromInstance(Her.Current);
            Container.BindInstance(Container);
        }