public AssessmentGameState(IDragManager dragManager, Assessment assessment, AssessmentResultState resultState, AssessmentGame game) { this.assessment = assessment; this.resultState = resultState; this.assessmentGame = game; this.dragManager = dragManager; }
public void Check(List <PlaceholderBehaviour> placeholders, List <IQuestion> questions, IDragManager dragManager) { isAnimating = true; coroutineEnded = false; allCorrect = false; Coroutine.Start(CheckCoroutine(placeholders, questions, dragManager)); }
private void OnMouseDown(MouseDownEvent evt) { if (evt.button != 0) { return; } var ele = evt.currentTarget as VisualElement; if (ele != null && ele is IDragManager) { IDragManager manager = ele as IDragManager; var drag = manager.draggableElements.FirstOrDefault(item => item.ContainsPoint(ele.ChangeCoordinatesTo(item, evt.localMousePosition))); if (drag != null) { m_MouseDownStartPos = evt.localMousePosition; currentClickedElement = drag; } } }
public DefaultLogicInjector(IDragManager dragManager, IQuestionDecorator decorator) { this.dragManager = dragManager; this.decorator = decorator; ResetRound(); }
private IEnumerator CheckCoroutine(List <PlaceholderBehaviour> placeholders, List <IQuestion> questions, IDragManager dragManager) { dragManager.DisableInput(); bool areAllCorrect = AreQuestionsCorrect(questions); if (areAllCorrect) { // Just trigger OnQuestionAnswered events if all are correct foreach (var q in questions) { var behaviour = q.gameObject.GetComponent <QuestionBehaviour>(); behaviour.OnQuestionAnswered(); AssessmentConfiguration.Instance.Context.GetLogManager().OnAnswer(q.LetterData(), true); yield return(TimeEngine.Wait(behaviour.TimeToWait())); } } else { foreach (var p in placeholders) { if (p.LinkedDroppable != null) { var set = p.Placeholder.GetQuestion().GetAnswerSet(); var answ = p.LinkedDroppable.GetAnswer(); if (set.IsCorrect(answ) == false) { AssessmentConfiguration.Instance.Context.GetLogManager().OnAnswer(answ.Data(), false); p.LinkedDroppable.Detach(true); } } } } allCorrect = areAllCorrect; while (wrongAnswerAnimationPlaying) { yield return(null); // wait only if previous message has not finished } if (allCorrect) { if (AppConstants.VerboseLogging) { Debug.Log("CheckCoroutine CORRECT"); } audioManager.PlaySound(Sfx.StampOK); yield return(TimeEngine.Wait(0.4f)); checkmarkWidget.Show(true); yield return(TimeEngine.Wait(1.0f)); } else { if (AppConstants.VerboseLogging) { Debug.Log("CheckCoroutine WRONG"); } wrongAnswerAnimationPlaying = true; Coroutine.Start(WrongAnswerCoroutine()); } coroutineEnded = true; dragManager.EnableInput(); }
public void SetDragManager(IDragManager dragManager) { this.dragManager = dragManager; }
public SortingLogicInjector(IDragManager dragManager, IQuestionDecorator questionDecorator) : base(dragManager, questionDecorator) { }
public DefaultLogicInjector(IDragManager dragManager, AssessmentEvents events) { this.dragManager = dragManager; this.events = events; ResetRound(); }
private IEnumerator CheckCoroutine(List <PlaceholderBehaviour> placeholders, List <IQuestion> questions, IDragManager dragManager) { WrongSoundPlayed = false; CorrectSoundPlayed = false; dragManager.DisableInput(); bool areAllCorrect = AreQuestionsCorrect(questions); if (areAllCorrect) { // Log learning progress foreach (var p in placeholders) { if (p.LinkedDroppable != null) { var set = p.Placeholder.GetQuestion().GetAnswerSet(); var answ = p.LinkedDroppable.GetAnswer(); if (set.IsCorrect(answ)) { AssessmentConfiguration.Instance.Context.GetLogManager().OnAnswered(answ.Data(), true); } var pos = p.gameObject.transform.localPosition; pos.y -= 3.5f; MarkYes(pos); } } ItemFactory.Instance.GetAntura().CorrectAssessment(audioManager); // Just trigger OnQuestionAnswered events if all are correct foreach (var q in questions) { yield return(Wait.For(q.QuestionBehaviour.TimeToWait())); q.QuestionBehaviour.OnQuestionAnswered(); yield return(Wait.For(q.QuestionBehaviour.TimeToWait())); } } else { foreach (var p in placeholders) { if (p.LinkedDroppable != null) { var set = p.Placeholder.GetQuestion().GetAnswerSet(); var answ = p.LinkedDroppable.GetAnswer(); if (set.IsCorrect(answ) == false) { AssessmentConfiguration.Instance.Context.GetLogManager().OnAnswered(answ.Data(), false); PlayWrongSound(); p.LinkedDroppable.Detach(true); var pos = p.gameObject.transform.localPosition; pos.y -= 3.5f; TutorialUI.MarkNo(pos, TutorialUI.MarkSize.Normal); } else { var pos = p.gameObject.transform.localPosition; pos.y -= 3.5f; MarkYes(pos); } } } } allCorrect = areAllCorrect; while (wrongAnswerAnimationPlaying) { yield return(null); } if (allCorrect) { if (events != null && events.OnPreQuestionsAnswered != null) { yield return(new WaitCoroutine(events.OnPreQuestionsAnswered())); } yield return(Wait.For(1.0f)); } else { wrongAnswerAnimationPlaying = true; Koroutine.Run(WrongAnswerCoroutine()); } coroutineEnded = true; dragManager.EnableInput(); }
public SortingLogicInjector(IDragManager dragManager, AssessmentEvents events) : base(dragManager, events) { }