示例#1
0
        IEnumerator AllCorrectCoroutine()
        {
            audioManager.PlaySound(Sfx.StampOK);
            yield return(TimeEngine.Wait(0.4f));

            widget.Show(true);
            yield return(TimeEngine.Wait(1.0f));
        }
示例#2
0
        IEnumerator AllCorrectCoroutine()
        {
            audioManager.PlayStampSound();
            yield return(Wait.For(0.4f));

            widget.Show(true);
            yield return(Wait.For(1.0f));
        }
示例#3
0
        IEnumerator AllCorrectCoroutine()
        {
            audioManager.PlayStampSound();

            // NDMichele: playing question as we finish dragging
            var question = GameObject.FindObjectOfType <QuestionBehaviour>();

            if (question != null)
            {
                question.ReadMeSound();
            }

            yield return(Wait.For(0.4f));

            widget.Show(true);
            yield return(Wait.For(1.0f));
        }
        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();
        }