/// <summary> /// Evaluates the normal answer. /// </summary> /// <returns>The normal answer.</returns> /// <param name="answer">Answer.</param> /// <param name="isTutorial">If set to <c>true</c> is tutorial.</param> protected virtual void EvaluateNormalAnswer(Action <IRoundEvaluationResultVO> callback, IAnswerVO answer, bool isTutorial = false) { int oldPoints = Score; bool wasCorrect = IsAnswerCorrect(answer); if (wasCorrect && (_warmUpState != WarmUpState.Enabled)) { UpdateScore(); } CompleteRound(wasCorrect, isTutorial); _currentRoundResult = new RoundEvaluationResultVO( wasCorrect, answer, _currentRound.Solutions, GetAllPropertiesUpdates(), answer == null, _startReactionDateTime, 1, true ); _roundHistory.First(x => x.RoundDataVO == _currentRound).RoundResult.Add(_currentRoundResult); callback(_currentRoundResult); }
// Usually here some indication is shown that the answer was wrong, for now we do nothing but finish the round public void ShowWrong(IRoundEvaluationResultVO dataVo) { System.Diagnostics.Debug.WriteLine("ShowWrong"); _cachedField[((FlashGlanceRoundItemVO)_roundData.Solutions[0]).GridPosition].Disappear(); ItemHidden.Dispatch(dataVo.Solutions[0]); FeedbackShown.Dispatch(); }
private int CalcAnswer(IRoundEvaluationResultVO roundResult, int index) { if (roundResult.IsTimeOut) { return(TIMEOUT); } return(roundResult.AnswerCorrect ? CORRECT : GetErrorCode(index)); }
#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); }
public void PlayWrongSound(IRoundEvaluationResultVO result) { // Level down. if (result.Updates.Any((updateVO) => { return(updateVO is DifficultyUpdateVO && updateVO.ValueChange < 0); })) { _soundManager.PlaySound(AudioEffect.LevelDown); } else { _soundManager.PlaySound(_nextWrongSound); if (_nextWrongSound == AudioEffect.Wrong1) { _nextWrongSound = AudioEffect.Wrong2; } else { _nextWrongSound = AudioEffect.Wrong1; } } }
public void PlayCorrectSound(IRoundEvaluationResultVO result) { // Level up. if (result.Updates.Any((updateVO) => { return(updateVO is DifficultyUpdateVO && updateVO.ValueChange > 0); })) { _soundManager.PlaySound(AudioEffect.LevelUp); } else { _soundManager.PlaySound(_nextCorrectSound); if (_nextCorrectSound == AudioEffect.Correct1) { _nextCorrectSound = AudioEffect.Correct2; } else { _nextCorrectSound = AudioEffect.Correct1; } } }
protected void HandleAnswerResult(IRoundEvaluationResultVO result) { _tutorialActivityManager.EvaluateResult(result); DisableTutorialAfterAnswer(); _hud.Update(result.Updates.OfType <IExerciseHudVO>().ToList()); var terminatorTriggers = result.Updates.OfType <ITerminatorTrigger>(); foreach (var t in terminatorTriggers) { _terminator.HandelTermiantionTrigger(t); } if (result.AnswerCorrect) { CurrentState = result.RoundCompleted ? BaseStates.CORRECT_ANSWER : BaseStates.CORRECT_STEP; } else { CurrentState = result.RoundCompleted ? BaseStates.WRONG_ANSWER : BaseStates.WRONG_STEP; } }
public void EvaluateResult(IRoundEvaluationResultVO result) { if (TutorialSystemEnabled) { if (result.RoundCompleted) { if (result.AnswerCorrect && !_roundHasWrongStep) { _goodRunsInARow++; _badRunsInARow = 0; if (TutorialActive && _goodRunsInARow >= _goodRunsToDisable) { _goodRunsInARow = 0; TutorialActive = false; _logger.LogMessage(LogLevel.Informational, "Tutorial disactivated"); } } else { _badRunsInARow++; _goodRunsInARow = 0; if (!TutorialActive && _badRunsInARow >= _badRunsToActivate) { _badRunsInARow = 0; TutorialActive = true; _logger.LogMessage(LogLevel.Informational, "Tutorial activated"); } } _roundHasWrongStep = false; } else { if (!result.AnswerCorrect) { _roundHasWrongStep = true; } } } }
/// <summary> /// Evaluates the stepped answer. /// </summary> /// <returns>The stepped answer.</returns> /// <param name="answer">Answer.</param> /// <param name="isTutorial">If set to <c>true</c> is tutorial.</param> protected virtual void EvaluateSteppedAnswer(Action <IRoundEvaluationResultVO> callback, IAnswerVO answer, bool isTutorial = false, int stepNr = -1) { int oldPoints = Score; bool wasCorrect = IsAnswerCorrect(answer, true, stepNr); int finishedStepsNr = CalculateFinishedStepsNr(); bool roundCompleted = RoundCompleted(wasCorrect, finishedStepsNr); if (wasCorrect && (_warmUpState != WarmUpState.Enabled)) { UpdateScore(); UpdateStepGoodrunPercent(finishedStepsNr); } if (roundCompleted) { // adjust whole round result if needed CompleteRound(IsWholeRoundCorrect(wasCorrect), isTutorial); } _currentRoundResult = new RoundEvaluationResultVO( wasCorrect, answer, _currentRound.Solutions, GetAllPropertiesUpdates(), answer == null, _startReactionDateTime, finishedStepsNr, roundCompleted ); // reset _startReactionDateTime so we have a correct reaction time in between step answers if the round is not completed if (!roundCompleted) { StartMonitorReactionTime(DateTime.Now); } _roundHistory.First(x => x.RoundDataVO == _currentRound).RoundResult.Add(_currentRoundResult); callback(_currentRoundResult); }
private void ShowWrong(IRoundEvaluationResultVO dataVO) { ShowFeedback(false); }
private void ShowCorrect(IRoundEvaluationResultVO dataVO) { ShowFeedback(true); }
public virtual void ShowWrong(IRoundEvaluationResultVO feedbackData) { Trace(feedbackData); controllerProxy.OnShowWrong.Dispatch(feedbackData); }