public override void CreateRound(Action <IExerciseRoundDataVO> callback, IExerciseRoundConfigurationVO exerciseRoundConfiguration = null)
        {
            ValidateMinItemsOnRound();

            int timeout = ExerciseConfiguration.GetTimeoutByLevel(CurrentDifficulty);

            List <IRoundItem> solutions = new List <IRoundItem> {
                _solutionChain[_currentSolutionIndex]
            };

            if (_lastRoundLevelChange != LevelState.EQUAL)
            {
                _colorIndex = CurrentDifficulty % _colors.Length;
                for (int i = _solutionChain.IndexOf(_allItems[0]); i < _solutionChain.Count; i++)
                {
                    _solutionChain[i].Color = _colors[_colorIndex];
                }
            }

            _currentRound = new FlashGlanceRoundDataVO(CloneItems(_allItems),
                                                       solutions,
                                                       _lastRoundLevelChange,
                                                       _warmUpState,
                                                       timeout,
                                                       _solutionChain,
                                                       _currentSolutionIndex,
                                                       _castedConfig.MapHeight,
                                                       _castedConfig.MapWidth);

            base.CreateRound(callback, exerciseRoundConfiguration);
        }
Ejemplo n.º 2
0
        #pragma warning disable CS1998
        /// <inheritdoc />
        public virtual void CreateRound(Action <IExerciseRoundDataVO> callback, IExerciseRoundConfigurationVO exerciseRoundConfiguration = null)
        {
            // Remove empty rounds from the history (might be created by tutorial)
            if (_roundHistory.Count > 0 && _roundHistory[_roundHistory.Count - 1].RoundResult.Count == 0)
            {
                _roundHistory.RemoveAt(_roundHistory.Count - 1);
            }

            if (_lastRoundLevelChange == LevelState.NEW && CurrentDifficulty == 0)
            {
                TriggerTutorial(new StartupTutorialTrigger());
            }

            _currentRoundResult      = null;
            _currentRound.Difficulty = _currentDifficulty;
            _roundHistory.Add(new FullRoundVO(_currentRound));
            callback(_currentRound);
        }
Ejemplo n.º 3
0
        public override void CreateRound(Action <IExerciseRoundDataVO> callback, IExerciseRoundConfigurationVO exerciseRoundConfiguration = null)
        {
            MemoflowConfiguration configuration = ExerciseConfiguration as MemoflowConfiguration;


            List <IRoundItem> correctAnswers;

            int numCards          = configuration.Levels[CurrentDifficulty].NumCards;
            var currenQueueLength = _questQueue == null || (_questQueue != null && _questQueue.Count == 0) ?
                                    0 : Math.Min(_questQueue.Count - 1, _questQueue.Count - 1 - numCards);

            string tutorialTextId = "";

            if (_lastRoundLevelChange == LevelState.NEW)
            {
                _questQueue    = GetFirstSteps();
                tutorialTextId = _startTutorialTextId;
            }
            else
            {
                _questQueue.Add(CreateStep());
            }

            if (_lastRoundLevelChange != LevelState.EQUAL)
            {
                _colorIndex = CurrentDifficulty % _availableColors.Length;
                for (int i = currenQueueLength; i < _questQueue.Count; i++)
                {
                    ((MemoflowStepVO)_questQueue[i]).SymbolColor = _availableColors[_colorIndex];
                }
            }

            correctAnswers = new List <IRoundItem>()
            {
                new MemoflowSolution(((MemoflowStepVO)_questQueue[_questQueue.Count - 1]).Match(((MemoflowStepVO)_questQueue[_questQueue.Count - numCards]), _matchTypes))
            };


            _currentRound = new MemoflowRoundDataVO(_questQueue, correctAnswers, _lastRoundLevelChange, _warmUpState, configuration.GetTimeoutByLevel(CurrentDifficulty), numCards, _matchTypes, tutorialTextId);

            base.CreateRound(callback, exerciseRoundConfiguration);
        }