Пример #1
0
        public WorldService(ICompanyEmployeeRepository companyEmployeeRepository, IContractRepository contractRepository, IContractService contractService,
                            ICitizenRepository citizenRepository, IConfigurationRepository configurationRepository, IEquipmentRepository equipmentRepository,
                            IPartyService partyService, ICongressCandidateService congressCandidateService, ICongressVotingService congressVotingService,
                            ICountryService countryService, IBattleService battleService, IRegionService regionService, ICompanyService companyService,
                            IEmbargoService embargoService, IWarService warService, IEmployeeService employeeService, IMPPService mppService, IWalletService walletService,
                            INewDayRepository newDayRepository, IHotelService hotelService, IHouseService houseService)
        {
            this.citizenRepository         = citizenRepository;
            this.configurationRepository   = configurationRepository;
            this.equipmentRepository       = equipmentRepository;
            this.companyEmployeeRepository = companyEmployeeRepository;
            this.contractRepository        = contractRepository;
            this.contractService           = contractService;
            this.partyService             = partyService;
            this.congressCandidateService = congressCandidateService;
            this.congressVotingService    = congressVotingService;
            this.countryService           = countryService;
            this.battleService            = battleService;
            this.regionService            = regionService;
            this.companyService           = companyService;
            this.embargoService           = embargoService;
            this.warService       = warService;
            this.employeeService  = employeeService;
            this.mppService       = mppService;
            this.walletService    = Attach(walletService);
            this.newDayRepository = newDayRepository;
            this.hotelService     = hotelService;
            this.houseService     = houseService;

            citizenRepository.SetTimeout(300);
            equipmentRepository.SetTimeout(300);
        }
Пример #2
0
 public ErrandService(BotOMatContext botOMatContext, IBattleService battleService)
 {
     _botOMatContext  = botOMatContext;
     _battleService   = battleService;
     _randomGenerator = new Random();
     _stopwatch       = new Stopwatch();
 }
Пример #3
0
        public void SetupRandomBattle_OnlyOneHero_ShouldThrowInvalidOperationException()
        {
            var            battleServiceBuilder = new BattleServiceBuilder().WithHeroes(1);
            IBattleService service = battleServiceBuilder.Build();

            Assert.That(() => service.SetupRandomBattle(), Throws.InvalidOperationException);
        }
    void Init()
    {
        _battleService = BattleService.Instance;
        _rubik = GameObject.Find("3X RUBIK");

        Camera.mainCamera.backgroundColor = GlobalConfiguration.BackgroundColor;
    }
Пример #5
0
 public DebugController(IPopupService popupService, ICountryRepository countryRepository, ICongressVotingService congressVotingService,
                        ICongressVotingRepository congressVotingRepository, IBattleService battleService, IBattleRepository battleRepository,
                        ICompanyService companyService, IWalletService walletService, IMarketService marketService, IEquipmentService equipmentService,
                        ITransactionScopeProvider transactionScopeProvider, ICompanyRepository companyRepository, IEquipmentRepository equipmentRepository,
                        IHotelRepository hotelRepository, IMahService mahService, IHouseService houseService, IHouseRepository houseRepository,
                        HouseDayChangeProcessor houseDayChangeProcessor) : base(popupService)
 {
     this.countryRepository        = countryRepository;
     this.congressVotingService    = congressVotingService;
     this.congressVotingRepository = congressVotingRepository;
     this.battleService            = battleService;
     this.battleRepository         = battleRepository;
     this.companyService           = companyService;
     this.walletService            = walletService;
     this.marketService            = marketService;
     this.equipmentService         = equipmentService;
     this.transactionScopeProvider = transactionScopeProvider;
     this.companyRepository        = companyRepository;
     this.equipmentRepository      = equipmentRepository;
     this.hotelRepository          = hotelRepository;
     this.mahService              = mahService;
     this.houseService            = houseService;
     this.houseRepository         = houseRepository;
     this.houseDayChangeProcessor = houseDayChangeProcessor;
 }
Пример #6
0
 public BattleController(
     IBattleService battleService,
     IBattleLogService battleLogService)
 {
     _battleService    = battleService;
     _battleLogService = battleLogService;
 }
Пример #7
0
 public QueueService(
     IBattleService battleService)
 {
     _battleService = battleService;
     _botsRandom    = new Random();
     _bots          = new HashSet <BotDefinition>();
     _queues        = BattleHelper.GetNewModeQueue();
 }
Пример #8
0
 public Handler(
     GameContext gameContext,
     IQueueService queueService,
     IBattleService battleService)
 {
     _gameContext   = gameContext;
     _queueService  = queueService;
     _battleService = battleService;
 }
Пример #9
0
 public Handler(
     IQueueService queueService,
     IBattleService battleService,
     GameContext gameContext)
 {
     _queueService  = queueService;
     _battleService = battleService;
     _gameContext   = gameContext;
 }
 public BattleFlowService(
     IBattleService battleService,
     IBattleSimulatorService battleSimulatorService,
     IUnitOfWork unitOfWork)
 {
     _battleService          = battleService;
     _battleSimulatorService = battleSimulatorService;
     _unitOfWork             = unitOfWork;
 }
Пример #11
0
 public ArenaHub(
     IBattleService battleService,
     IQueueService queueService,
     ILogger <ArenaHub> logger)
 {
     _battleService = battleService;
     _queueService  = queueService;
     _logger        = logger;
 }
Пример #12
0
 public BattleController(IBattleRepository battleRepository, IBattleService battleService, IWarRepository warRepository, IWarService warService,
                         IProductRepository productRepository, IEquipmentRepository equipmentRepository, IPopupService popupService) : base(popupService)
 {
     this.battleRepository    = battleRepository;
     this.battleService       = battleService;
     this.warRepository       = warRepository;
     this.warService          = warService;
     this.productRepository   = productRepository;
     this.equipmentRepository = equipmentRepository;
 }
Пример #13
0
 public WarController(IWarRepository warRepository, IWarService warService, IBattleService battleService, ICountryRepository countryRepository, IRegionRepository regionRepository,
                      Entities.Repository.IWalletRepository walletRepository, IPopupService popupService) : base(popupService)
 {
     this.warRepository     = warRepository;
     this.warService        = warService;
     this.battleService     = battleService;
     this.countryRepository = countryRepository;
     this.regionRepository  = regionRepository;
     this.walletRepository  = walletRepository;
 }
Пример #14
0
 public RoundService(AppDbContext dbContext, UserManager <User> userManager,
                     IBattleService battleService, IDataService dataService, IHubContext <RoundHub,
                                                                                          IRoundHubClient> roundHubContext)
 {
     _dbContext       = dbContext;
     _userManager     = userManager;
     _battleService   = battleService;
     _roundHubContext = roundHubContext;
     _dataService     = dataService;
 }
        public BattleServiceTests()
        {
            var game = new Game {
                Matrix = new Matrix(3)
            };
            var neighboringCellsMarker = new NeighboringCellsMarker(game);

            _creationService = new CreationService(game, neighboringCellsMarker);
            _battleService   = new BattleService(game);
        }
 public BattleShipGameService(IDrawService drawService,
                              IMapService mapService,
                              IBattleService battleService,
                              IShipService shipService)
 {
     this.drawService   = drawService;
     this.mapService    = mapService;
     this.battleService = battleService;
     this.shipService   = shipService;
 }
Пример #17
0
 public Handler(
     IdentityUserManager userManager,
     IBattleService battleService,
     GameContext gameContext,
     RegistryContext registryContext)
 {
     _userManager     = userManager;
     _battleService   = battleService;
     _gameContext     = gameContext;
     _registryContext = registryContext;
 }
Пример #18
0
 public ArenaHostedService(
     IQueueService queueService,
     IBattleService battleService,
     IServiceProvider serviceProvider,
     ILogger <ArenaHostedService> logger)
 {
     _queueService    = queueService;
     _battleService   = battleService;
     _serviceProvider = serviceProvider;
     _logger          = logger;
     _counter         = 10;
 }
Пример #19
0
 public BattleSimulatorService(
     IAttackStrategyComposite attackStrategyComposite,
     IBattleService battleService,
     IAttackChanceService attackChanceService,
     IUnitOfWork unitOfWork,
     IBattleLogRepository battleLogRepository)
 {
     _attackStrategyComposite = attackStrategyComposite;
     _battleService           = battleService;
     _attackChanceService     = attackChanceService;
     _unitOfWork          = unitOfWork;
     _battleLogRepository = battleLogRepository;
 }
Пример #20
0
 public BattleController(IStatisticsService statisticsService,
                         IBattleService battleService,
                         ICreationService creationService,
                         ICoordinatesParser coordinatesParser,
                         IGameLifetimeService gameLifetimeService,
                         Game game)
 {
     _statisticsService   = statisticsService;
     _battleService       = battleService;
     _creationService     = creationService;
     _coordinatesParser   = coordinatesParser;
     _gameLifetimeService = gameLifetimeService;
     _game = game;
 }
Пример #21
0
 public GameController(IWorldService worldService, IWalletService walletService, ICurrencyRepository currencyRepository, IDebugDayChangeRepository debugDayChangeRepository
                       , IPopupService popupService, ICitizenRepository citizenRepository, IWarService warService, IEntityRepository entityRepository,
                       IBattleService battleService, IBattleRepository battleRepository) : base(popupService)
 {
     this.worldService             = worldService;
     this.walletService            = walletService;
     this.currencyRepository       = currencyRepository;
     this.debugDayChangeRepository = debugDayChangeRepository;
     this.citizenRepository        = citizenRepository;
     this.warService       = warService;
     this.entityRepository = entityRepository;
     this.battleRepository = battleRepository;
     this.battleService    = battleService;
 }
Пример #22
0
        private static (int, int) AssertRandomBattleSetup(int amountOfHeroes)
        {
            //Arrange
            int     index1 = -1, index2 = -1;
            var     battleServiceBuilder = new BattleServiceBuilder().WithHeroes(amountOfHeroes);
            IBattle createdBattle        = null;

            battleServiceBuilder.BattleFactoryMock
            .Setup(factory => factory.CreateNewBattle(It.IsAny <IHero>(), It.IsAny <IHero>()))
            .Callback((IHero fighter1, IHero fighter2) =>
            {
                index1 = battleServiceBuilder.AllHeroes.ToList().IndexOf(fighter1);
                index2 = battleServiceBuilder.AllHeroes.ToList().IndexOf(fighter2);

                Assert.That(index1, Is.GreaterThanOrEqualTo(0),
                            "You must use a hero from the repository to create the battle using the factory.");

                Assert.That(index2, Is.GreaterThanOrEqualTo(0),
                            "You must use a hero from the repository to create the battle using the factory.");

                Assert.That(index1, Is.Not.EqualTo(index2), "The same hero cannot be picked twice in one battle.");

                createdBattle = new Mock <IBattle>().Object;
            })
            .Returns((IHero fighter1, IHero fighter2) => createdBattle);
            IBattleService service = battleServiceBuilder.Build();

            //Act
            IBattle battle = service.SetupRandomBattle();

            //Assert
            Assert.That(battle, Is.Not.Null, "The returned battle is null.");
            battleServiceBuilder.HeroRepositoryMock.Verify(repo => repo.GetAll(), Times.Once,
                                                           "The repository should be used to retrieve all heroes.");
            battleServiceBuilder.BattleFactoryMock.Verify(
                factory => factory.CreateNewBattle(It.IsAny <IHero>(), It.IsAny <IHero>()), Times.Once,
                "The CreateNewBattle method of the factory has not been called.");
            Assert.That(battle, Is.SameAs(createdBattle),
                        "The battle created by the factory is not the instance that is returned.");

            return(index1, index2);
        }
 public MainWindow(IBattleService battleService)
 {
     InitializeComponent();
 }
Пример #24
0
 public FightController(IBattleService battleService)
 {
     this.battleService = battleService;
 }
 public BattleOrchestrator(IBattleService battleService)
 {
     _battleService = battleService;
 }
Пример #26
0
        public Battle StartRessistanceBattle(Citizen startingCitizen, Region defendingRegion, IBattleService battleService)
        {
            Country attackingCountry = startingCitizen.Country;
            var     activeWar        = GetActiveRessistanceWar(attackingCountry, defendingRegion.CountryID.Value);

            if (activeWar == null)
            {
                return(StartRessistanceWar(startingCitizen, attackingCountry, defendingRegion, battleService).Battles.First());
            }
            else
            {
                using (var trs = transactionScopeProvider.CreateTransactionScope())
                {
                    transactionService.PayForResistanceBattle(startingCitizen, defendingRegion, this);
                    var battle = battleService.CreateBattle(activeWar, defendingRegion.ID, WarSideEnum.Attacker);

                    trs.Complete();
                    return(battle);
                }
            }
        }
Пример #27
0
 public BattlesController(IBattleService battleService)
 {
     _battleService = battleService;
 }
 public Handler(IBattleService battleService)
 {
     _battleService = battleService;
 }
Пример #29
0
 public BattleController(IBattleService battleService, IUserService userService)
 {
     _battleService = battleService;
     _userService   = userService;
 }
Пример #30
0
 /// <summary>
 /// To be called when the Service starts
 /// </summary>
 /// <param name="service"></param>
 public static void OnServiceStart(IBattleService service)
 {
     ((BattleSystem)Instance).mService = service;
 }
Пример #31
0
 public BattleController(IBattleService battleService)
 {
     _battleService  = battleService;
     _userController = new UserController(new UserService());
 }
Пример #32
0
        public War StartRessistanceWar(Citizen startingCitizen, Country attackingCountry, Region defendingRegion, IBattleService battleService)
        {
            var defendingCountry = defendingRegion.Country;
            var war = new War()
            {
                Attacker             = attackingCountry,
                Defender             = defendingCountry,
                StartDay             = GameHelper.CurrentDay,
                Active               = true,
                EndDay               = null,
                IsRessistanceWar     = true,
                RessistanceStarterID = startingCitizen.ID
            };

            List <CountryInWar> participatingCountries = getParticipatingCountries(attackingCountry, defendingCountry, isRessistanceWar: true);

            war.CountryInWars = participatingCountries;


            using (var trs = transactionScopeProvider.CreateTransactionScope())
            {
                warRepository.Add(war);
                ConditionalSaveChanges(warRepository);

                transactionService.PayForResistanceWar(startingCitizen, defendingRegion, this);
                battleService.CreateBattle(war, defendingRegion.ID, WarSideEnum.Attacker);

                trs.Complete();
                return(war);
            }
        }