Example #1
0
 public ScoreProcessor(DifficultyLevelsConfig difficultyLevels, BlocksSpeedSettings blocksSpeedSettings, IScoreView scoreView, IScoreModel scoreModel)
 {
     _difficultyLevels    = difficultyLevels;
     _blocksSpeedSettings = blocksSpeedSettings;
     ScoreView            = scoreView;
     ScoreModel           = scoreModel;
 }
Example #2
0
        public void AddScore(IScoreModel score, int lessonId)
        {
            if (score == null)
            {
                throw new ArgumentNullException("score");
            }

            EntityValidationResult result = _entityValidator.ValidateEntity(score);
            if (result.IsValid == false)
            {
                throw new InvalidScoreException(result.ValidationResults);
            }

            if (score.Visit == null)
            {
                ((ScoreModel)score).Visit = new Visit
                {
                    Visitor = new User
                    {
                        UserId = score.AssignedTo.UserId,
                        FirstName = score.AssignedTo.FirstName,
                        LastName = score.AssignedTo.LastName
                    },
                    Lesson = new Lesson
                    {
                        LessonId = lessonId
                    }
                };

                _visitRepository.CreateVisit(_visitDtoMapper.Map(score.Visit));
            }

            _scoreRepository.AddScore(_scoreDtoMapper.Map(score));
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterLogic"/> class.
 /// </summary>
 /// <param name="ball">Ball Model Interface.</param>
 /// <param name="character">Character  Model Interface.</param>
 /// <param name="score">Score Model Interface.</param>
 /// <param name="timer">Timer Model Interface.</param>
 public CharacterLogic(IBallModel ball, ICharacterModel character, IScoreModel score, ITimerModel timer)
 {
     this.ball      = ball;
     this.character = character;
     this.score     = score;
     this.timer     = timer;
 }
Example #4
0
 public FellCommand(ITetrominoModel tetrominoModel, IGridModel gridModel, IGameStateModel gameStateModel,
                    IScoreModel scoreModel)
 {
     _tetrominoModel = tetrominoModel;
     _gridModel      = gridModel;
     _gameStateModel = gameStateModel;
     _scoreModel     = scoreModel;
 }
Example #5
0
 public GameSetupCommand(IDataService dataService, IGridModel gridModel, IGameStateModel gameStateModel,
                         IScoreModel scoreModel, ITetrominoModel tetrominoModel)
 {
     _dataService    = dataService;
     _gridModel      = gridModel;
     _gameStateModel = gameStateModel;
     _scoreModel     = scoreModel;
     _tetrominoModel = tetrominoModel;
 }
Example #6
0
 public ScoresViewModel()
 {
     try
     {
         this.model  = BootStrapper.Resolve <IScoreModel>();
         this.scores = this.model.GetAll();
     }
     catch (Exception ex)
     {
         ApplicationErrorHandler.HandleException(ex);
     }
 }
 public RunnerTestSetViewModel()
 {
     try
     {
         this.wrongAnswers  = new List <TestItem>();
         this.testSetsModel = BootStrapper.Resolve <ITestSetsModel>();
         this.scoreModel    = BootStrapper.Resolve <IScoreModel>();
     }
     catch (Exception ex)
     {
         ApplicationErrorHandler.HandleException(ex);
     }
 }
Example #8
0
        public IScoreDto Map(IScoreModel score)
        {
            if (score == null)
            {
                throw new ArgumentNullException("score");
            }

            return new ScoreDto
            {
                ScoreId = score.ScoreId,
                Score = score.Score,
                AssignedTo = (UserDto)_userDtoMapper.Map(score.AssignedTo),
                AssignedBy = (UserDto)_userDtoMapper.Map(score.AssignedBy),
                Task = score.Task,
                Visit = score.Visit == null ? null : (VisitDto)_visitDtoMapper.Map(score.Visit)
            };
        }
        public void AddScore(IScoreModel score, int lessonId)
        {
            if (score == null)
            {
                throw new ArgumentNullException("score");
            }

            EntityValidationResult result = _entityValidator.ValidateEntity(score);
            if (result.IsValid == false)
            {
                throw new InvalidLessonException(result.ValidationResults);
            }

            if (!_authorizationManager.CheckAccess(new AuthorizationContext(_principal, "Score", "Create")))
            {
                throw new SecurityException("User doesn't have enough permission for creating score");
            }

            _scoreService.AddScore(score, lessonId);
        }
Example #10
0
        public HGameplay(IInstanceProvider instanceProvider)
        {
            audioPlayer               = instanceProvider.GetInstance <IAudioPlayerModel>();
            customSaveModel           = instanceProvider.GetInstance <ICustomSaveModel>();
            scoreModel                = instanceProvider.GetInstance <IScoreModel>();
            gameEndModel              = instanceProvider.GetInstance <IGameEndModel>();
            sessionStatistics         = instanceProvider.GetInstance <ISessionStatistics>();
            interstitialsDisplayModel = instanceProvider.GetInstance <InterstitialsDisplayModel>();
            gameStartSignal           = instanceProvider.GetInstance <GameStartSignal>();
            updateBestScoreSignal     = instanceProvider.GetInstance <UpdateBestScoreSignal>();
            newLevelSignal            = instanceProvider.GetInstance <NewLevelSignal>();
            endLevelSignal            = instanceProvider.GetInstance <EndLevelSignal>();
            currentLevelChangeSignal  = instanceProvider.GetInstance <CurrentLevelChangeSignal>();

            gameContinueSignal = instanceProvider.GetInstance <GameContinueSignal>();
            gameContinueSignal.AddListener(ContinueGame);

            gamePauseSignal = instanceProvider.GetInstance <GamePauseSignal>();
            gamePauseSignal.AddListener(PauseGame);

            gameResumeSignal = instanceProvider.GetInstance <GameResumeSignal>();
            gameResumeSignal.AddListener(ResumeGame);
        }
Example #11
0
 public void DisplayScoreView(IScoreModel scoreModel)
 {
     _scoreText.text = scoreModel.CurrentScore.FormatScore();
     _linesText.text = scoreModel.CurrentLinesCount.ToString();
     _levelText.text = (scoreModel.CurrentLevelIndex + 1).ToString();
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScoreLogic"/> class.
 /// </summary>
 /// <param name="score">Score Model Interface.</param>
 /// <param name="ball">Ball Model interface.</param>
 public ScoreLogic(IScoreModel score, IBallModel ball)
 {
     this.score = score;
     this.ball  = ball;
 }
Example #13
0
        /*
        [Route("")]
        [HttpPost]
        public IHttpActionResult Post(CreateScoreViewModel score)
        {
            if (score == null)
            {
                throw new ArgumentNullException("score");
            }

            _scoreService.AddScore(score.ToScore());

            return Ok();
        }

        [Route("")]
        [HttpPut]
        public IHttpActionResult Put(UpdateScoreViewModel score)
        {
            if (score == null)
            {
                throw new ArgumentNullException("score");
            }

            _scoreService.UpdateScore(score.ToScore());

            return Ok();
        }

        [Route("")]
        [HttpDelete]
        public IHttpActionResult Delete(int scoreId)
        {
            _scoreService.DeleteScore(scoreId);

            return Ok();
        }
         * */
        private static ScoreViewModel MapScoreToView(IScoreModel s)
        {
            return new ScoreViewModel
            {
                ScoreId = s.ScoreId,
                AssignedById = s.AssignedBy.UserId,
                AssignedToId = s.AssignedTo.UserId,
                DisplayDate = s.Visit.Lesson.Date,
                LessonId = s.Visit.Lesson.LessonId,
                Score = s.Score,
                VisitId = s.Visit.VisitId,
                Task = s.Task
            };
        }
Example #14
0
        public void UpdateScore(IScoreModel score)
        {
            if (score == null)
            {
                throw new ArgumentNullException("score");
            }

            EntityValidationResult result = _entityValidator.ValidateEntity(score);
            if (result.IsValid == false)
            {
                throw new InvalidScoreException(result.ValidationResults);
            }

            if (_scoreRepository.GetScores().Any(s => s.ScoreId == score.ScoreId))
            {
                throw new EntityNotFoundException("score", score.ScoreId);
            }

            _scoreRepository.UpdateScore(_scoreDtoMapper.Map(score));
        }
 public LinesCollectedCommand(GameData gameData, IScoreModel scoreModel)
 {
     _gameData   = gameData;
     _scoreModel = scoreModel;
 }