public static async Task EnsurePopulatedAsync(IApplicationBuilder app)
        {
            AppDataContext context = app.ApplicationServices
                                     .CreateScope().ServiceProvider
                                     .GetRequiredService <AppDataContext>();

            if (context.Database.GetPendingMigrations().Any())
            {
                context.Database.Migrate();
            }
            IHeroesService heroesService = app.ApplicationServices
                                           .CreateScope().ServiceProvider
                                           .GetRequiredService <IHeroesService>();

            if (await context.Heroes.FirstOrDefaultAsync() == null)
            {
                await heroesService.CreateHeroAsync("Superman");

                await heroesService.CreateHeroAsync("Wonder Woman");

                await heroesService.CreateHeroAsync("Flash");

                await heroesService.CreateHeroAsync("Batman");

                await heroesService.CreateHeroAsync("Iron Man");

                await heroesService.CreateHeroAsync("Wolverine");

                await heroesService.CreateHeroAsync("The Hulk");

                await heroesService.CreateHeroAsync("Professor X");
            }
        }
Beispiel #2
0
        public BattleWorld(IHeroesService heroesService, GraphicResources graphicResources)
        {
            _heroesService = heroesService;
            _content = graphicResources.Content;
            _entityWorld = new EntityWorld();
            var systemManager = _entityWorld.SystemManager;
            EntityCreator entityCreator = new EntityCreator(_entityWorld);
            BattleEngine.EntityCreator = entityCreator;
            _fighterManager = new FighterManager(_entityWorld);
            EntitySystem.BlackBoard.SetEntry("Resources", graphicResources);

            systemManager.SetSystem(new CharacterPlacingSystem(graphicResources), GameLoopType.Update, 0);
            systemManager.SetSystem(new EffectManagerSystem(), GameLoopType.Update, 0);
            systemManager.SetSystem(new MovingSystem(), GameLoopType.Update, 1);
            systemManager.SetSystem(new ActingSystem(), GameLoopType.Update, 3);
            systemManager.SetSystem(new AISkillSelectionSystem(_fighterManager), GameLoopType.Update, 4);
            systemManager.SetSystem(new ExpirationSystem(), GameLoopType.Update, 5);
            systemManager.SetSystem(new InputSkillSelectionSystem(_fighterManager, graphicResources), GameLoopType.Update, 5);
            systemManager.SetSystem(new AnimationSystem(entityCreator), GameLoopType.Update, 5);
            systemManager.SetSystem(new ParticleGeneratorSystem(), GameLoopType.Update, 5);

            systemManager.SetSystem(new ImageRenderingSystem(graphicResources), GameLoopType.Draw, 0);
            systemManager.SetSystem(new CharacterInfoRenderingSystem(graphicResources), GameLoopType.Draw, 1);
            systemManager.SetSystem(new ParticleRenderingSystem(graphicResources), GameLoopType.Draw, 1);
            systemManager.SetSystem(new ColoredTextRenderingSystem(graphicResources), GameLoopType.Draw, 2);
            systemManager.SetSystem(new InputSkillSelectionRenderingSystem(graphicResources), GameLoopType.Draw, 2);
        }
 public HeroesController(IOptions <AppSettings> appSettings, IMapper mapper,
                         IHeroesService heroesService, IUserService userService, ILogger <HomeController> logger)
 {
     _appSettings   = appSettings.Value;
     _mapper        = mapper;
     _heroesService = heroesService;
     _logger        = logger;
     _userService   = userService;
 }
Beispiel #4
0
 public HeroesController(
     IHeroesService heroesService,
     IMapper mapper,
     DataContext context)
 {
     _heroesService = heroesService;
     _mapper        = mapper;
     _context       = context;
 }
Beispiel #5
0
        public BattleState(IHeroesService heroesService, GraphicResources graphicResources)
        {
            _heroesService = heroesService;
            _graphicResources = graphicResources;

            _world = new BattleWorld(heroesService, graphicResources);
            _backgroundSprite = new Sprite(graphicResources.SpriteBatch);
            _backgroundSprite.Dimension = graphicResources.Window.Dimension;
            _backgroundSprite.Texture = _graphicResources.Content.Load<Texture2D>("Backgrounds\\Forêt");
        }
        public BattleGeneratorState(IGameDataService dataService, IHeroesService heroesService, GUI gui)
        {
            _dataService = dataService;
            _heroesService = heroesService;
            _gui = gui;
            _choices = _dataService.GetNames(DataType.Hero).ToList();
            _choices.Add(FoeMenuTitle);
            _choices.Add(OK);

            _textBox = null;
            _heroMenuTitle = "";
        }
 public HeroesController(ILogger <HeroesController> logger, IHeroesService heroesService)
 {
     _logger        = logger;
     _heroesService = heroesService;
 }
Beispiel #8
0
 public HeroesController(IHeroesService service)
 {
     this.service = service;
 }
Beispiel #9
0
 public HeroesController(ILogger <HeroesController> logger, IHeroesService heroesService, IOptions <WebOptions> webOptionValue)
 {
     _logger        = logger;
     _heroesService = heroesService;
     webOptions     = webOptionValue.Value;
 }
Beispiel #10
0
 public HeroesController(IHeroesService heroesService)
 {
     _heroesService = heroesService;
 }
 public HeroesControllerTest()
 {
     service    = new HeroesServiceFake();
     controller = new HeroesController(service);
 }