예제 #1
0
 public BattleController(DataContext dataContext, GamingService gamingService, BattleMapper battleMapper, IOptions <GameSettings> gameSettingsOptions, LevelManager levelManager, AchievementService achievementService, NotificationManager notificationManager, AccountManager accountManager, BattleManager battleManager)
 {
     _dataContext         = dataContext;
     _gamingService       = gamingService;
     _battleMapper        = battleMapper;
     _levelManager        = levelManager;
     _achievementService  = achievementService;
     _notificationManager = notificationManager;
     _accountManager      = accountManager;
     _battleManager       = battleManager;
     _gameSettingsOptions = gameSettingsOptions.Value;
 }
예제 #2
0
        static async Task Main(string[] args)
        {
            try
            {
                IServiceCollection services      = new ServiceCollection();
                IConfiguration     configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").Build();
                services.RegisterMergenServices(configuration, true);
                var sp = services.BuildServiceProvider();
                ApplicationEvents.ApplicationStart(sp, configuration);

                var db            = sp.GetRequiredService <DataContext>();
                var gamingService = new GamingService(db);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
예제 #3
0
        public OneToOneBattleTests()
        {
            IServiceCollection services      = new ServiceCollection();
            IConfiguration     configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").Build();

            services.RegisterMergenServices(configuration, true);
            var sp = services.BuildServiceProvider();

            ApplicationEvents.ApplicationStart(sp, configuration);

            var db = sp.GetRequiredService <DataContext>();

            _gamingService = new GamingService(db);

            _player1 = new Account
            {
                Id = 1
            };

            _player2 = new Account
            {
                Id = 2
            };

            for (int i = 0; i < 100; i++)
            {
                db.Categories.Add(new Category {
                    Title = "Cat " + i
                });
                db.Questions.Add(new Question {
                    Body = "Body " + i, Answer1 = "Answer1 " + i, Answer2 = "Answer2 " + i
                });
            }

            db.SaveChanges();
        }