Пример #1
0
        public bool IsDataMatching(ILivingLetterData data1, ILivingLetterData data2)
        {
            LetterEqualityStrictness strictness;

            switch (Variation)
            {
            case AssessmentVariation.LetterName:
                strictness = LetterEqualityStrictness.LetterBase;
                break;

            case AssessmentVariation.LetterAny:
            case AssessmentVariation.MatchLettersToWord:
            case AssessmentVariation.WordsWithLetter:
            case AssessmentVariation.CompleteWord:
            case AssessmentVariation.OrderLettersOfWord:
            case AssessmentVariation.CompleteWord_Form:
            case AssessmentVariation.MatchLettersToWord_Form:
                strictness = LetterEqualityStrictness.WithVisualForm;
                break;

            default:
                strictness = LetterEqualityStrictness.WithVisualForm;
                break;
            }
            return(DataMatchingHelper.IsDataMatching(data1, data2, strictness));
        }
Пример #2
0
        public override bool IsDataMatching(ILivingLetterData data1, ILivingLetterData data2)
        {
            LetterEqualityStrictness strictness;

            switch (Variation)
            {
            case FastCrowdVariation.LetterForm:
                strictness = LetterEqualityStrictness.WithVisualForm;
                break;

            case FastCrowdVariation.BuildWord:
            case FastCrowdVariation.Word:
            case FastCrowdVariation.LetterName:
            case FastCrowdVariation.Counting:
            case FastCrowdVariation.Alphabet:
            case FastCrowdVariation.Image:
            case FastCrowdVariation.CategoryForm:
            case FastCrowdVariation.OrderedImage_Numbers:
            case FastCrowdVariation.OrderedImage_Colors:
            case FastCrowdVariation.OrderedImage_Months:
            case FastCrowdVariation.OrderedImage_Days_Seasons:
                strictness = LetterEqualityStrictness.LetterBase;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(DataMatchingHelper.IsDataMatching(data1, data2, strictness));
        }
Пример #3
0
 private bool isCorrectAnswer(ILivingLetterData data)
 {
     // TODO: place this into the configuration, like in FastCrowd!
     return(DataMatchingHelper.IsDataMatching(
                (data as LL_LetterData),
                (m_oCurrentCorrectAnswer as LL_LetterData), LetterEqualityStrictness.WithVisualForm));
     //return m_oCurrentCorrectAnswer.Equals(data);
 }
Пример #4
0
        public StrollingLivingLetter GetLetter(ILivingLetterData data)
        {
            for (int i = 0; i < letters.Count; i++)
            {
                LivingLetterController lov = letters[i].gameObject.GetComponent <LivingLetterController>();
                if (DataMatchingHelper.IsDataMatching(lov.Data, data, LetterEqualityStrictness.Letter))
                {
                    return(letters[i]);
                }
            }

            return(null);
        }
        public override bool IsDataMatching(ILivingLetterData data1, ILivingLetterData data2)
        {
            LetterEqualityStrictness strictness;

            switch (Variation)
            {
            case MixedLettersVariation.Alphabet:
                strictness = LetterEqualityStrictness.WithVisualForm;
                break;

            case MixedLettersVariation.BuildWord:
                strictness = LetterEqualityStrictness.WithVisualForm;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(DataMatchingHelper.IsDataMatching(data1, data2, strictness));
        }
Пример #6
0
        void OnAnswered(CircleButton clickedButton)
        {
            if (Finished)
            {
                return;
            }
            Finished = true;
            game.DisableRepeatPromptButton();

            if (ReadingGameConfiguration.Instance.ShowTimer && !TutorialMode)
            {
                UI.MinigamesUI.Timer.Pause();
            }

            bool isCorrect = clickedButton != null && DataMatchingHelper.IsDataMatching(clickedButton.Answer, correctLLData, LetterEqualityStrictness.Letter);

            game.Context.GetAudioManager().PlaySound(isCorrect ? Sfx.OK : Sfx.KO);

            if (isCorrect)
            {
                clickedButton?.SetColor(Color.green);
            }
            else
            {
                if (clickedButton != null)
                {
                    TutorialUI.MarkNo(clickedButton.transform.position);
                }
            }

            if (ReadingGameConfiguration.Instance.CurrentGameType == ReadingGameConfiguration.GameType.ReadAndListen)
            {
                if (isCorrect)
                {
                    correctLLData = new LL_ImageData(correctLLData.Id);
                    var runLetter = game.runLettersBox.AddRunLetter(correctLLData, Vector3.one * 4);
                    runLetter.Stop();
                    runLetter.PlayAnimation(LLAnimationStates.LL_dancing);
                }
                else
                {
                    game.runLettersBox.AnimateAll(LLAnimationStates.LL_tickling);
                }

                // First read the answer you clicked
                if (clickedButton != null)
                {
                    game.Context.GetAudioManager().PlayVocabularyData(clickedButton.Answer, autoClose: false, callback: () =>
                    {
                        // Then read the one that is correct, if not already correct, and highlight it
                        if (!isCorrect)
                        {
                            if (TutorialMode)
                            {
                                Finished = false;
                            }
                            else
                            {
                                correctButton.SetColor(Color.green);
                                game.Context.GetAudioManager().PlayVocabularyData(correctButton.Answer,
                                                                                  callback: () =>
                                {
                                    // Then translate the sentence
                                    game.Context.GetAudioManager().PlayVocabularyData(
                                        game.CurrentQuestion.GetQuestion(),
                                        autoClose: false,
                                        keeperMode: KeeperMode.NativeNoSubtitles,
                                        callback: () => { Next(isCorrect, clickedButton); });
                                });
                            }
                        }
                        else
                        {
                            // Just translate the sentence
                            game.Context.GetAudioManager().PlayVocabularyData(game.CurrentQuestion.GetQuestion(),
                                                                              autoClose: false,
                                                                              keeperMode: KeeperMode.NativeNoSubtitles, callback: () =>
                            {
                                Next(isCorrect, clickedButton);
                            });
                        }
                    });
                }
                else
                {
                    // Time out. Just as if you failed.
                    if (TutorialMode)
                    {
                        Finished = false;
                    }
                    else
                    {
                        correctButton.SetColor(Color.green);
                        game.Context.GetAudioManager().PlayVocabularyData(correctButton.Answer,
                                                                          callback: () =>
                        {
                            // Then translate the sentence
                            game.Context.GetAudioManager().PlayVocabularyData(
                                game.CurrentQuestion.GetQuestion(),
                                autoClose: false,
                                keeperMode: KeeperMode.NativeNoSubtitles,
                                callback: () => { Next(isCorrect, clickedButton); });
                        });
                    }
                }
            }
            else
            {
                Next(isCorrect, clickedButton);
            }
        }
Пример #7
0
 public virtual bool IsDataMatching(ILivingLetterData data1, ILivingLetterData data2)
 {
     return(DataMatchingHelper.IsDataMatching(data1, data2, LetterEqualityStrictness.Letter));
 }
Пример #8
0
        public void OnEggButtonPressed(ILivingLetterData letterData)
        {
            if (isSequence && game.eggButtonBox.GetEggButton(letterData).IsPressed())
            {
                return;
            }

            if (!enteredRepeatMode)
            {
                game.Context.GetAudioManager().PlayVocabularyData(letterData, false);
            }
            else
            {
                game.Context.GetAudioManager().PlaySound(Sfx.UIButtonClick);
            }

            if (showTutorial)
            {
                if (!enteredRepeatMode)
                {
                    TutorialUI.Clear(false);
                }
                tutorialDelayTimer    = tutorialDelayTime;
                tutorialCorrectActive = false;
            }

            if (DataMatchingHelper.IsDataMatching(letterData, game.CurrentQuestion.Answers[letterOnSequence], LetterEqualityStrictness.Letter))
            {
                if (isSequence)
                {
                    game.eggButtonBox.GetEggButton(letterData).SetPressed();
                    PositiveFeedback();
                    game.Context.GetLogManager().OnAnswered(letterData, true);
                }
                else
                {
                    repeatInputHasProgressed = true;

                    if (!enteredRepeatMode)
                    {
                        EggConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.OK);
                        enteredRepeatMode = true;
                        game.HintButton.gameObject.SetActive(false);
                        Vector3 clickPosition = game.eggButtonBox.GetButtons(false)[0].transform.position;
                        TutorialUI.ClickRepeat(clickPosition, 4);
                        game.eggButtonBox.RemoveButtons((a) => { return(a != letterData); });

                        if (!showTutorial)
                        {
                            game.Context.GetLogManager().OnAnswered(letterData, true);
                        }
                    }
                }
            }
            else
            {
                game.eggButtonBox.SetButtonsOnStandardColor(game.eggButtonBox.GetEggButton(letterData));

                if (showTutorial)
                {
                    ShowTutorialPressedWrong(letterData);
                }
                else
                {
                    NegativeFeedback();
                    game.Context.GetLogManager().OnAnswered(letterData, false);
                }
            }
        }
Пример #9
0
 private bool isCorrectAnswer(ILivingLetterData data)
 {
     return(DataMatchingHelper.IsDataMatching(data, m_oCurrentCorrectAnswer, LetterEqualityStrictness.WithVisualForm));
 }