public static IMapper BuildMapper()
        {
            var configuration = new MapperConfiguration(cfg =>
            {
                CustomerComponentConfiguration.ConfigureMappers(cfg);
                ProductComponentConfiguration.ConfigureMappers(cfg);
                FeatureComponentConfiguration.ConfigureMappers(cfg);
                IncidentComponentConfiguration.ConfigureMappers(cfg);
                JourneyComponentConfiguration.ConfigureMappers(cfg);
                UserComponentConfiguration.ConfigureMappers(cfg);
                SquadComponentConfiguration.ConfigureMappers(cfg);
                MemberComponentConfiguration.ConfigureMappers(cfg);
                SourceComponentConfiguration.ConfigureMappers(cfg);
                SourceItemComponentConfiguration.ConfigureMappers(cfg);
                IndicatorComponentConfiguration.ConfigureMappers(cfg);
                SourceComponent.ConfigureMappers(cfg);
                SecurityRiskComponent.ConfigureMappers(cfg);
                ReliabilityRiskComponent.ConfigureMappers(cfg);
                MigrationComponent.ConfigureMappers(cfg);
            });

            configuration.AssertConfigurationIsValid();
            var mapper = configuration.CreateMapper();

            return(mapper);
        }
示例#2
0
 public SourceController(SourceComponent sourceComponent) : base()
 {
     this._sourceComponent = sourceComponent;
 }
示例#3
0
        public void Attach()
        {
            _scene.Init();
            _physicsContainer.Gravity = new Vector3(0, -800, 0);

            var entity = _scene.CreateEntity();

            _scene.AddComponent(entity, new CameraComponent {
                Camera = _camera, Active = true
            });

            var texture = _factory.Create <ITexture2D>();

            texture.SetData("Assets/landscape.jpeg");

            var soundBuffer = _soundManager.CreateSoundBuffer();

            soundBuffer.SetData("Assets/jump.wav");

            var source = _soundManager.CreateSource();

            source.Gain = 1f;

            entity = _scene.CreateEntity();
            _scene.AddComponent(entity, new PositionComponent {
                Position = new Vector3(-400, -100, 0)
            });
            _scene.AddComponent(entity, new SizeComponent {
                Width = 100, Height = 100
            });
            _scene.AddComponent(entity, new TextureComponent {
                Texture = texture
            });
            var physicsComponent = new PhysicsComponent();

            _scene.AddComponent(entity, physicsComponent);
            var sourceComponent = new SourceComponent {
                Source = source, SoundBuffer = soundBuffer
            };

            _scene.AddComponent(entity, sourceComponent);
            _scene.AddComponent(entity, new ControlScript(physicsComponent, sourceComponent));

            entity = _scene.CreateEntity();
            _scene.AddComponent(entity, new PositionComponent {
                Position = new Vector3(0, -360, 0)
            });
            _scene.AddComponent(entity, new SizeComponent {
                Width = 1280, Height = 10
            });
            _scene.AddComponent(entity, new PhysicsComponent {
                Fixed = true
            });

            entity = _scene.CreateEntity();
            _scene.AddComponent(entity, new PositionComponent {
                Position = new Vector3(0, -200, 0)
            });
            _scene.AddComponent(entity, new SizeComponent {
                Width = 600, Height = 10
            });
            _scene.AddComponent(entity, new PhysicsComponent {
                Fixed = true
            });

            entity = _scene.CreateEntity();
            _scene.AddComponent(entity, new PositionComponent {
                Position = new Vector3(420, -95, 0), Rotation = new Vector3(0, 0, 45)
            });
            _scene.AddComponent(entity, new SizeComponent {
                Width = 300, Height = 10
            });
            _scene.AddComponent(entity, new PhysicsComponent {
                Fixed = true
            });

            entity = _scene.CreateEntity();
            _scene.AddComponent(entity, new PositionComponent {
                Position = new Vector3(0, -100, 0)
            });
            _scene.AddComponent(entity, new SizeComponent {
                Width = 10, Height = 300
            });
            _scene.AddComponent(entity, new PhysicsComponent {
                Fixed = true
            });

            _physicsContainer.Start(144, _scene.EntityContainer);
            _soundManager.Start(60, _scene.EntityContainer);
        }
示例#4
0
 public ControlScript(PhysicsComponent physics, SourceComponent source)
 {
     _physics = physics;
     _source  = source;
 }
        public static void AddApplicationProviders(this IServiceCollection servs, IConfiguration configuration)
        {
            // ASP.NET HttpContext dependency


            // Components


            servs.AddTransient <AppSettingQueryComponent>();
            servs.AddTransient <AppSettingComponent>();

            servs.AddTransient <CustomerQueryComponent>();
            servs.AddTransient <CustomerComponent>();

            servs.AddTransient <ProductQueryComponent>();
            servs.AddTransient <ProductComponent>();


            servs.AddTransient <SourceItemComponent>();
            servs.AddTransient <SourceComponent>();
            servs.AddTransient <IndicatorComponent>();

            servs.AddTransient <FeatureQueryComponent>();
            servs.AddTransient <FeatureComponent>();

            servs.AddTransient <SquadQueryComponent>();
            servs.AddTransient <SquadComponent>();

            servs.AddTransient <JourneyQueryComponent>();
            servs.AddTransient <JourneyComponent>();

            servs.AddTransient <JourneyMapComponent>();

            servs.AddTransient <UserComponent>();
            servs.AddTransient <UserQueryComponent>();

            servs.AddTransient <MemberComponent>();
            servs.AddTransient <MemberQueryComponent>();

            servs.AddTransient <MigrationComponent>();

            servs.AddTransient <IncidentComponent>();

            servs.AddTransient <CacheComponent>();

            servs.AddTransient <ConfigurationComponent>();

            servs.AddTransient <SecurityRiskComponent>();

            servs.AddTransient <ReliabilityRiskComponent>();
            // Gateways
            servs.AddTransient <IDateTimeGateway, DateTimeGateway>();

            // Infra
            servs.AddAspNetCoreIndentityProvider();

            // Automapper
            var mapperCfg = new MapperConfiguration(cfg =>
            {
                CustomerComponentConfiguration.ConfigureMappers(cfg);
                ProductComponentConfiguration.ConfigureMappers(cfg);
                FeatureComponentConfiguration.ConfigureMappers(cfg);
                IncidentComponentConfiguration.ConfigureMappers(cfg);
                JourneyComponentConfiguration.ConfigureMappers(cfg);
                UserComponentConfiguration.ConfigureMappers(cfg);
                SquadComponentConfiguration.ConfigureMappers(cfg);
                MemberComponentConfiguration.ConfigureMappers(cfg);
                SourceComponentConfiguration.ConfigureMappers(cfg);
                SourceItemComponentConfiguration.ConfigureMappers(cfg);
                SquadFeatureComponentConfiguration.ConfigureMappers(cfg);
                IndicatorComponentConfiguration.ConfigureMappers(cfg);
                SourceComponent.ConfigureMappers(cfg);
                SecurityRiskComponent.ConfigureMappers(cfg);
                ReliabilityRiskComponent.ConfigureMappers(cfg);
                MigrationComponent.ConfigureMappers(cfg);
            });

            IMapper mapper = mapperCfg.CreateMapper();

            servs.AddSingleton(mapper);
        }