Example #1
0
        public Game(ICollection <string> userIds, IMapInfo mapInfo, IGameSettings settings)
        {
            if (userIds == null)
            {
                throw new ArgumentNullException(nameof(userIds));
            }
            if (mapInfo == null)
            {
                throw new ArgumentNullException(nameof(mapInfo));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            this.actionPoints = settings.ActionPoints;

            var tanks = userIds.Select(x => new Tank(new Health(settings.TankHealthPoint), x)).ToArray();

            var map = new Map(new MapCreationData(mapInfo, tanks), new BattlefieldBuilder(),
                              new RandomSpawnService());

            // намерено скрываем типы используемых интерфейсов внутри класса игры
            this.mapAdapter    = new MapAdapter(map);
            this.bulletService = new BulletService(this.mapAdapter, settings.BulletActionPoints);
            this.moveService   = new MoveService(this.mapAdapter);
            this.zoneService   = new ZoneService(this.mapAdapter, settings.ZoneRadius);

            this.DestroyedObjects = new DestroyedInfo(new Dictionary <string, Coordinates>(), new ICellContentInfo[0]);
        }
Example #2
0
 public GamePlayApiController(IUserService userService, ICardService cardService, IGamePlayService gamePlayService, IMoveService moveService)
     : base(userService)
 {
     _cardService     = cardService;
     _gamePlayService = gamePlayService;
     _moveService     = moveService;
 }
Example #3
0
 public GameStateService(INotationService notationService, IPGNService pgnService, IMoveService moveService, IAttackService attackService)
 {
     _notationService = notationService;
     _pgnService      = pgnService;
     _moveService     = moveService;
     _attackService   = attackService;
 }
Example #4
0
 public InitializeMetaData(IMoveService moveService, IDashboardService dashboardService, IMaintainService maintainService, IFillService fillService)
 {
     _moveService      = moveService;
     _maintainService  = maintainService;
     _dashboardService = dashboardService;
     _fillService      = fillService;
 }
Example #5
0
 public CoordinateTests()
 {
     _orthogonalService = ServiceProvider.GetService <IOrthogonalService>();
     _attackService     = ServiceProvider.GetService <IAttackService>();
     _gameStateService  = ServiceProvider.GetService <IGameStateService>();
     _moveService       = ServiceProvider.GetService <IMoveService>();
 }
        public IGameMoveResponse Handle(MoveRequestObject moveRequest, IMoveService moveService)
        {
            var number = new Number(moveRequest.MoveInformation);
            var move = new GuessMyNumberMove(number);
            var moveResponse = moveService.Handle<INumber, IAttemptResult>(moveRequest.PlayerName, moveRequest.SessionName, move);

            return moveResponse;
        }
Example #7
0
 public Player(IAttackService attackService, IMoveService moveService, IDeathService deathService,
               UserData userData)
 {
     _attackService = attackService;
     _moveService   = moveService;
     _deathService  = deathService;
     UserData       = userData;
 }
 public RoundService(IRepositoryBase <Round> repository,
                     IMoveService moveService,
                     IGameService gameService)
     : base(repository)
 {
     _gameService = gameService;
     _moveService = moveService;
 }
Example #9
0
 public KegSearchViewModel(IMoveService moveService, INavigationService navigationService) : base(navigationService)
 {
     _moveService       = moveService;
     HomeCommand        = new DelegateCommand(HomeCommandRecieverAsync);
     BarcodeScanCommand = new DelegateCommand(BarcodeScanCommandRecieverAsync);
     BulkUpdateCommand  = new DelegateCommand(BulkUpdateCommandRecieverAsync);
     SearchCommand      = new DelegateCommand(SearchCommandRecieverAsync);
     HandleReceivedMessages();
 }
Example #10
0
 public BoardsController(IStorage storage, IMoveService moveService,
                         IDiamondGeneratorService diamondGeneratorService,
                         IGameObjectGeneratorService gameObjectGenerators)
 {
     this._storage                    = storage;
     this._moveService                = moveService;
     this._diamondGeneratorService    = diamondGeneratorService;
     this._gameObjectGeneratorService = gameObjectGenerators;
 }
        public SearchedManifestsListViewModel(IMoveService moveService, INavigationService navigationService) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");

            _moveService = moveService;

            ItemTappedCommand      = new DelegateCommand <ManifestSearchResponseModel>((model) => ItemTappedCommandRecieverAsync(model));
            SearchManifestsCommand = new DelegateCommand(SearchManifestsCommandRecieverAsync);
        }
        public MoveController(IStringLocalizer <GlobalResource> globalLocalizer, IConfiguration configuration,
                              IMoveService moveService)
            : base(moveService, globalLocalizer)
        {
            _globalLocalizer = globalLocalizer;
            _configuration   = configuration;

            this.moveService = moveService;
        }
Example #13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="boardService">Service responsible for creation of board</param>
 /// <param name="moveService">Service responsible for cell changes</param>
 /// <param name="gameConfigurationService"></param>
 public GamePlayController(
     IBoardService boardService,
     IMoveService moveService,
     IGameConfigurationService gameConfigurationService)
 {
     _boardService             = boardService;
     _moveService              = moveService;
     _gameConfigurationService = gameConfigurationService;
 }
Example #14
0
    /// <summary>
    /// Load all the required stuff into memory
    /// </summary>
    private void Init(IServiceGetter services)
    {
        _moveService            = services.Get <IMoveService>();
        _moveRangeService       = services.Get <IMoveRangeService>();
        _pokemonService         = services.Get <IPokemonService>();
        _scenarioPokemonService = services.Get <IScenarioPokemonService>();
        _scenarioWarriorService = services.Get <IScenarioWarriorService>();

        _moveRangeService = services.Get <IMoveRangeService>();
    }
        public ScanditScanViewModel(IMoveService moveService, INavigationService navigationService, IPageDialogService dialogService) : base(navigationService)
        {
            //_navigationService = navigationService;
            _moveService   = moveService;
            _dialogService = dialogService;

            DoneCommand = new DelegateCommand(DoneCommandRecieverAsync);

            InitSettings();
        }
Example #16
0
        public void UT_When_HandleMove_Then_Success()
        {
            var sessionName = "player1-vs-player2";
            var player1 = new TestSessionPlayer()
            {
                SessionName = sessionName,
                PendingToMove = false,
                Information = new User
                {
                    DisplayName = "Player 1",
                    Name = "player1"
                }
            };
            var player2 = new TestSessionPlayer()
            {
                SessionName = sessionName,
                PendingToMove = true,
                Information = new User
                {
                    DisplayName = "Player 2",
                    Name = "player2"
                }
            };
            var session = new GameSession(player1, player2);

            var testMoveObject = new TestMoveObject { Answer = "Test Answer" };
            var testMove = new TestMove(testMoveObject);

            var moveResponse = new TestResponse(new TestResponseObject { IsCorrect = true }) { IsWin = false };

            var sessionServiceMock = new Mock<ISessionService>();

            sessionServiceMock
                .Setup(s => s.GetByName(It.Is<string>(x => x == sessionName)))
                .Returns(session)
                .Verifiable();

            var moveProcessorMock = new Mock<IMoveProcessor<TestMoveObject, TestResponseObject>>();

            moveProcessorMock
                .Setup(p => p.Process(It.Is<SessionGamePlayer>(x => x == player2), It.Is<IGameMove<TestMoveObject>>(m => m == testMove)))
                .Returns(moveResponse)
                .Verifiable();

            this.moveService = new MoveService<TestMoveObject, TestResponseObject>(sessionServiceMock.Object, moveProcessorMock.Object);

            var response = this.moveService.Handle(sessionName, player1.Information.Name, testMove);

            sessionServiceMock.VerifyAll();
            moveProcessorMock.VerifyAll();

            Assert.IsNotNull(response);
            Assert.AreEqual(moveResponse, response);
        }
        public SearchManifestsViewModel(IMoveService moveService, INavigationService navigationService) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");

            _moveService = moveService;

            ManifestsCommand           = new DelegateCommand(ManifestsCommandRecieverAsync);
            ManifestSenderCommand      = new DelegateCommand(ManifestSenderCommandRecieverAsync);
            ManifestDestinationCommand = new DelegateCommand(ManifestDestinationCommandRecieverAsync);
            SearchCommand = new DelegateCommand(SearchCommandRecieverAsync);
        }
Example #18
0
        public Player(IAttackService attackService, IMoveService moveService, IDeathService deathService,
                      string name, string passwordHash)
        {
            _attackService = attackService;
            _moveService   = moveService;
            _deathService  = deathService;
            Name           = name;
            Password       = passwordHash;

            Init();
        }
        public SearchPartnersViewModel(IMoveService moveService, INavigationService navigationService) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");

            _moveService = moveService;

            BackPartners         = "< Partners";
            BackPartnersCommand  = new DelegateCommand(BackPartnersCommandRecieverAsync);
            PartnerSearchCommand = new DelegateCommand(PartnerSearchCommandRecieverAsync);
            ItemTappedCommand    = new DelegateCommand <PartnerModel>((model) => ItemTappedCommandRecieverAsync(model));
        }
        public PalletizeDetailViewModel(IMoveService moveService, INavigationService navigationService) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");

            _moveService      = moveService;
            HomeCommand       = new DelegateCommand(HomeCommandRecieverAsync);
            ShareCommand      = new DelegateCommand(ShareCommandReciever);
            GridTappedCommand = new DelegateCommand(GridTappedCommandRecieverAsync);
            MovePalletCommand = new DelegateCommand(MovePalletCommandRecieverAsync);
            EditPalletCommand = new DelegateCommand(EditPalletCommandRecieverAsync);
        }
Example #21
0
        public SimulationService()
        {
            _cars = new List <Car>();

            var settings = new Settings
            {
                PixelsPerMeter = 10,
                TicksPerSecond = 10
            };

            _moveService = new MoveService(settings);
        }
        public FillScanReviewViewModel(INavigationService navigationService, IUuidManager uuidManager, IPageDialogService dialogService, IMoveService moveService, IManifestManager manifestManager, IGeolocationService geolocationService) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");
            _uuidManager        = uuidManager;
            _dialogService      = dialogService;
            _moveService        = moveService;
            _manifestManager    = manifestManager;
            _geolocationService = geolocationService;

            ScanCommand   = new DelegateCommand(ScanCommandRecieverAsync);
            SubmitCommand = new DelegateCommand(SubmitCommandRecieverAsync);
        }
Example #23
0
        public TurnServiceTests()
        {
            fakeDice        = new FakeDice();
            fakeBailAdvisor = new FakeBailAdvisor();
            board           = new Board(fakeDice);
            moveService     = new MoveService(board);
            player          = new Player("horse");
            var mortgageBroker  = new MortgageBroker();
            var mortgageAdvisor = new MortgageAdvisor();
            var mortgageService = new MortgageService(board, mortgageAdvisor, mortgageBroker);

            turnService = new TurnService(moveService, mortgageService, fakeBailAdvisor);
        }
        public ManifestsViewModel(IMoveService moveService, INavigationService navigationService) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");

            _moveService = moveService;

            HomeCommand         = new DelegateCommand(HomeCommandRecieverAsync);
            ActionSearchCommand = new DelegateCommand(ActionSearchCommandRecieverAsync);
            QueuedCommand       = new DelegateCommand(QueuedCommandReciever);
            DraftCommand        = new DelegateCommand(DraftCommandReciever);
            RecentCommand       = new DelegateCommand(RecentCommandReciever);
            ItemTappedCommand   = new DelegateCommand <ManifestModel>((model) => ItemTappedCommandRecieverAsync(model));
        }
Example #25
0
        public HandleWinnerHandler(
            IGameRepository gameRepository,
            ICardService cardService,
            IMoveService moveService,
            IMoveUserService moveUserService
            )
        {
            _gameRepository = gameRepository;

            _cardService     = cardService;
            _moveService     = moveService;
            _moveUserService = moveUserService;
        }
        public AddPartnerViewModel(IMoveService moveService, INavigationService navigationService, IPageDialogService dialogService, IUuidManager uuidManager) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");
            _dialogService = dialogService;
            _moveService   = moveService;
            _uuidManager   = uuidManager;

            CalcelCommand          = new DelegateCommand(CalcelCommandRecieverAsync);
            SubmitCommand          = new DelegateCommand(SubmitCommandRecieverAsync);
            ShippingAddressCommand = new DelegateCommand(ShippingAddressCommandRecieverAsync);
            BillingAddressCommand  = new DelegateCommand(BillingAddressCommandRecieverAsync);

            LoadPartnerAsync(null);
        }
Example #27
0
        public PartnersViewModel(IMoveService moveService, INavigationService navigationService) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");
            _moveService = moveService;

            InternalCommand         = new DelegateCommand(InternalCommandReciever);
            AlphabeticalCommand     = new DelegateCommand(AlphabeticalCommandReciever);
            ItemTappedCommand       = new DelegateCommand <PartnerModel>((model) => ItemTappedCommandRecieverAsync(model));
            SearchPartnerCommand    = new DelegateCommand(SearchPartnerCommandRecieverAsync);
            AddNewPartnerCommand    = new DelegateCommand(AddNewPartnerCommandRecieverAsync);
            BackCommand             = new DelegateCommand(BackCommandRecieverAsync);
            TextChangedCommand      = new DelegateCommand(TextChangedCommandRecieverAsync);
            InternalBackgroundColor = "#4E6388";
            InternalTextColor       = "White";
        }
Example #28
0
        public DefaultCharacterService(IRepository <ICharacter> repository,
                                       IMovementService movementService, ICharacterAttributeRowService attributeRowService,
                                       IMoveService moveService, IUniqueDataService uniqueDataService, IGameParameterParserService gameParameterParserService)
            : base(repository, gameParameterParserService)
        {
            Guard.VerifyObjectNotNull(attributeRowService, nameof(attributeRowService));
            Guard.VerifyObjectNotNull(moveService, nameof(moveService));
            Guard.VerifyObjectNotNull(movementService, nameof(movementService));
            Guard.VerifyObjectNotNull(uniqueDataService, nameof(uniqueDataService));

            _attributeRowService = attributeRowService;
            _moveService         = moveService;
            _movementService     = movementService;
            _uniqueDataService   = uniqueDataService;
        }
        public AddPalletsViewModel(IPalletizeService palletizeService, IMoveService moveService, INavigationService navigationService, IPageDialogService dialogService, IManifestManager manifestManager, IUuidManager uuidManager, IGeolocationService geolocationService) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");
            _dialogService      = dialogService;
            _palletizeService   = palletizeService;
            _moveService        = moveService;
            _manifestManager    = manifestManager;
            _uuidManager        = uuidManager;
            _geolocationService = geolocationService;

            SubmitCommand     = new DelegateCommand(SubmitCommandRecieverAsync);
            FillScanCommand   = new DelegateCommand(FillScanCommandRecieverAsync);
            FillKegsCommand   = new DelegateCommand(FillKegsCommandRecieverAsync);
            ItemTappedCommand = new DelegateCommand <PalletModel>(async(model) => await ItemTappedCommandRecieverAsync(model));
            DeleteItemCommand = new DelegateCommand <PalletModel>((model) => DeleteItemCommandReciever(model));
        }
        public MoveViewModel(IMoveService moveService, INavigationService navigationService, IPageDialogService dialogService, IManifestManager manifestManager, IUuidManager uuidManager, IGeolocationService geolocationService) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");
            _dialogService      = dialogService;
            _moveService        = moveService;
            _manifestManager    = manifestManager;
            _uuidManager        = uuidManager;
            _geolocationService = geolocationService;

            SelectLocationCommand = new DelegateCommand(SelectLocationCommandRecieverAsync);
            MoreInfoCommand       = new DelegateCommand(MoreInfoCommandRecieverAsync);
            ScanKegsCommad        = new DelegateCommand(ScanKegsCommadRecieverAsync);
            SaveDraftCommand      = new DelegateCommand(SaveDraftCommandRecieverAsync);
            CancelCommand         = new DelegateCommand(CancelCommandRecieverAsync);
            SubmitCommand         = new DelegateCommand(SubmitCommandRecieverAsync);
        }
        public ScanKegsViewModel(IMoveService moveService, INavigationService navigationService, IPageDialogService dialogService, IManifestManager manifestManager, IGetIconByPlatform getIconByPlatform) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");
            _dialogService     = dialogService;
            _moveService       = moveService;
            _manifestManager   = manifestManager;
            _getIconByPlatform = getIconByPlatform;

            DoneCommand            = new DelegateCommand(DoneCommandRecieverAsync);
            BarcodeScanCommand     = new DelegateCommand(BarcodeScanCommandReciever);
            BarcodeManualCommand   = new DelegateCommand(BarcodeManualCommandRecieverAsync);
            AddTagsCommand         = new DelegateCommand(AddTagsCommandRecieverAsync);
            LabelItemTappedCommand = new DelegateCommand <BarcodeModel>((model) => LabelItemTappedCommandRecieverAsync(model));
            IconItemTappedCommand  = new DelegateCommand <BarcodeModel>((model) => IconItemTappedCommandRecieverAsync(model));
            DeleteItemCommand      = new DelegateCommand <BarcodeModel>((model) => DeleteItemCommandReciever(model));
            LoadBrand();

            HandleUnsubscribeMessages();
            HandleReceivedMessages();
        }
        public MaintainScanViewModel(IMoveService moveService, IMaintainService maintainService, INavigationService navigationService, IGetIconByPlatform getIconByPlatform, IUuidManager uuidManager, IManifestManager manifestManager, IGeolocationService geolocationService) : base(navigationService)
        {
            //_navigationService = navigationService ?? throw new ArgumentNullException("navigationService");

            _moveService        = moveService;
            _maintainService    = maintainService;
            _getIconByPlatform  = getIconByPlatform;
            _uuidManager        = uuidManager;
            _manifestManager    = manifestManager;
            _geolocationService = geolocationService;

            SubmitCommand          = new DelegateCommand(SubmitCommandRecieverAsync);
            BackCommand            = new DelegateCommand(BackCommandRecieverAsync);
            BarcodeScanCommand     = new DelegateCommand(BarcodeScanCommandRecieverAsync);
            BarcodeManualCommand   = new DelegateCommand(BarcodeManualCommandRecieverAsync);
            LabelItemTappedCommand = new DelegateCommand <BarcodeModel>((model) => LabelItemTappedCommandRecieverAsync(model));
            IconItemTappedCommand  = new DelegateCommand <BarcodeModel>((model) => IconItemTappedCommandRecieverAsync(model));
            DeleteItemCommand      = new DelegateCommand <BarcodeModel>((model) => DeleteItemCommandReciever(model));

            LoadMaintenanceType();
            HandleReceivedMessages();
        }