public SampleQuestionWordsVariationProvider()
        {
            currentQuestion = -1;

            for (int i = 0; i < 32; i++)
            {
                List <ILivingLetterData> correctAnswers = new List <ILivingLetterData>();
                List <ILivingLetterData> wrongAnswers   = new List <ILivingLetterData>();

                for (int j = 0; j < 3; ++j)
                {
                    LL_WordData newWordData = AppManager.I.Teacher.GetRandomTestWordDataLL();

                    correctAnswers.Add(newWordData);
                }

                // At least 4 wrong words
                while (wrongAnswers.Count < 4)
                {
                    var word = AppManager.I.Teacher.GetRandomTestWordDataLL();

                    if (!correctAnswers.Contains(word) && !wrongAnswers.Contains(word))
                    {
                        wrongAnswers.Add(word);
                    }
                }

                var currentPack = new SampleQuestionPack(null, wrongAnswers, correctAnswers);
                questions.Add(currentPack);
            }
        }
Beispiel #2
0
        private IQuestion GenerateCustomQuestion(ILivingLetterData question, LL_LetterData correctLetter)
        {
            if (question == null)
            {
                throw new ArgumentNullException("Question Null");
            }
            if (correctLetter == null)
            {
                throw new ArgumentNullException("correct Letter");
            }
            LL_WordData word   = question as LL_WordData;
            var         wordGO = ItemFactory.Instance.SpawnQuestion(word);

            var partsToRemove = ArabicAlphabetHelper.FindLetter(AppManager.I.DB, word.Data, correctLetter.Data, false);

            partsToRemove.Shuffle(); //pick a random letter

            string text = ArabicAlphabetHelper.GetWordWithMissingLetterText(
                word.Data, partsToRemove[0], RemovedLetterChar);

            if (config == DefaultQuestionType.MissingForm)
            {
                wordGO.Label.text = text;
                AddCompleteWordEvent(word.TextForLivingLetter, wordGO);
            }

            wordGO.InstaShrink();
            correctLetter.Form = partsToRemove[0].letterForm;

            return(new DefaultQuestion(wordGO, 1, dialogues));
        }
Beispiel #3
0
        private IQuestion GenerateMissingLetterQuestion(ILivingLetterData data, ILivingLetterData letterToRemove)
        {
            var           imageData = new LL_ImageData(data.Id);
            LL_WordData   word      = (LL_WordData)data;
            LL_LetterData letter    = (LL_LetterData)letterToRemove;

            cacheCompleteWord = word.TextForLivingLetter;

            var partsToRemove = LanguageSwitcher.I.GetHelper(LanguageUse.Learning).FindLetter(AppManager.I.DB, word.Data, letter.Data, LetterEqualityStrictness.Letter);

            partsToRemove.Shuffle(); //pick a random letter

            string text = LanguageSwitcher.I.GetHelper(LanguageUse.Learning).GetWordWithMissingLetterText(
                word.Data, partsToRemove[0], removedLetterColor: "#000000");

            //Spawn word, then replace text with text with missing letter
            var wordGO = ItemFactory.Instance.SpawnQuestion(word);

            wordGO.InstaShrink();

            wordGO.Label.text   = text;
            cacheCompleteWordLL = wordGO;

            wordGO.SetExtendedBoxCollider();

            return(new ImageQuestion(wordGO, imageData, audioManager));
        }
Beispiel #4
0
        IQuestionPack IQuestionProvider.GetNextQuestion()
        {
            var         answerData = AppManager.I.DB.GetWordDataByRandom();
            LL_WordData randomWord = new LL_WordData(answerData.Id, answerData);

            StringTestData fakeData = new StringTestData(
                ArabicAlphabetHelper.ProcessArabicString(
                    "منذ لم نرك منذ مدة " + randomWord.Data.Arabic + " منذ مدة" +
                    "منذ لم نرك منذ مدة " +
                    "منذ لم نرك منذ مدة "));

            List <ILivingLetterData> wrongAnswers = new List <ILivingLetterData>();

            while (wrongAnswers.Count < 6)
            {
                var randomData = AppManager.I.DB.GetWordDataByRandom();

                if (randomData.Id != answerData.Id && !wrongAnswers.Any((a) => { return(a.Id == randomData.Id); }))
                {
                    wrongAnswers.Add(randomData.ConvertToLivingLetterData());
                }
            }

            return(new SampleQuestionPack(fakeData, wrongAnswers, new ILivingLetterData[] { randomWord }));
        }
Beispiel #5
0
        void RestoreQuestion(bool result)
        {
            LivingLetterController letterView = m_aoCurrentQuestionScene[m_iRemovedLLDataIndex].GetComponent <LetterBehaviour>().mLetter;

            foreach (GameObject _obj in m_aoCurrentQuestionScene)
            {
                _obj.GetComponent <LetterBehaviour>().Refresh();
            }

            if (result)
            {
                m_oEmoticonsController.EmoticonPositive();
            }
            else
            {
                m_oEmoticonsController.EmoticonNegative();
            }

            //change restored color letter with tag
            Color32 markColor = result ? new Color32(0x4C, 0xAF, 0x50, 0xFF) : new Color32(0xDD, 0x2C, 0x00, 0xFF);
            string  color     = result ? "#4CAF50" : "#DD2C00";

            if (MissingLetterConfiguration.Instance.Variation == MissingLetterVariation.Phrase)
            {
                letterView.Label.text = "<color=" + color + ">" + letterView.Label.text + "</color>";
            }
            else
            {
                LL_WordData word = (LL_WordData)m_oCurrQuestionPack.GetQuestion();
                letterView.Label.text = ArabicTextUtilities.GetWordWithMarkedLetterText(word.Data, m_oRemovedLetter, markColor, ArabicTextUtilities.MarkType.SingleLetter);
            }
        }
Beispiel #6
0
        IQuestionPack IQuestionProvider.GetNextQuestion()
        {
            var         answerData = AppManager.I.DB.GetAllWordData().RandomSelectOne();
            LL_WordData randomWord = new LL_WordData(answerData.Id, answerData);

            StringTestData fakeData = new StringTestData(
                LanguageSwitcher.I.GetHelper(LanguageUse.Learning).ProcessString(
                    "منذ لم نرك منذ مدة " + randomWord.Data.Text + " منذ مدة" +
                    "منذ لم نرك منذ مدة " +
                    "منذ لم نرك منذ مدة "));

            List <ILivingLetterData> wrongAnswers = new List <ILivingLetterData>();

            while (wrongAnswers.Count < 6)
            {
                var randomData = AppManager.I.DB.GetAllWordData().RandomSelectOne();

                if (randomData.Id != answerData.Id && !wrongAnswers.Any((a) => { return(a.Id == randomData.Id); }))
                {
                    wrongAnswers.Add(randomData.ConvertToLivingLetterData());
                }
            }

            return(new SampleQuestionPack(fakeData, wrongAnswers, new ILivingLetterData[] { randomWord }));
        }
Beispiel #7
0
        public void Init(LL_WordData _data)
        {
            wordData = _data;
            LLPrefab.Init(_data);

            //var text = ArabicFixer.Fix(_data.Data.Arabic);
            //tmpText.text = text;
        }
        List <LL_LetterData> GetLettersFromWord(LL_WordData _word)
        {
            List <LL_LetterData> letters = new List <LL_LetterData>();

            foreach (var letterData in ArabicAlphabetHelper.ExtractLetterDataFromArabicWord(_word.Data.Arabic))
            {
                letters.Add(letterData);
            }
            return(letters);
        }
Beispiel #9
0
        public void SetQuestionText(LL_WordData word, LL_LetterData markedLetter, Color color)
        {
            string text  = LanguageSwitcher.LearningHelper.ProcessString(word.Data.Text);
            var    parts = LanguageSwitcher.LearningHelper.FindLetter(AppManager.I.DB, word.Data, markedLetter.Data, LetterEqualityStrictness.Letter);

            if (parts.Count > 0)
            {
                text = LanguageSwitcher.LearningHelper.GetWordWithMarkedLetterText(word.Data, parts[0], color, MarkType.SingleLetter);
            }
            letter.Init(word, text, 1.3f);
        }
Beispiel #10
0
 public void Show(System.Action callback, Database.LocalizationDataId text, LL_WordData word = null)
 {
     if (word != null)
     {
         WidgetPopupWindow.I.ShowSentenceAndWord(callback, text, word);
     }
     else
     {
         WidgetPopupWindow.I.ShowSentence(callback, text);
     }
 }
Beispiel #11
0
        public void SetQuestionText(LL_WordData word, LL_LetterData markedLetter, Color color)
        {
            string text  = ArabicAlphabetHelper.ProcessArabicString(word.Data.Arabic);
            var    parts = ArabicAlphabetHelper.FindLetter(AppManager.I.DB, word.Data, markedLetter.Data, false);

            if (parts.Count > 0)
            {
                text = ArabicTextUtilities.GetWordWithMarkedLetterText(word.Data, parts[0], color, ArabicTextUtilities.MarkType.SingleLetter);
            }
            letter.Init(word, text, 1.3f);
        }
Beispiel #12
0
        private IQuestion GenerateQuestion(ILivingLetterData data)
        {
            cacheFullWordData = new LL_WordData(data.Id);

            if (AssessmentOptions.Instance.ShowQuestionAsImage)
            {
                data = new LL_ImageData(data.Id);
            }

            cacheFullWordDataLL = ItemFactory.Instance.SpawnQuestion(data);
            return(new DefaultQuestion(cacheFullWordDataLL, 0, audioManager));
        }
Beispiel #13
0
        public void SetQuestionText(LL_WordData word, int letterToMark, Color color)
        {
            string text = LanguageSwitcher.LearningHelper.ProcessString(word.Data.Text);

            var parts = LanguageSwitcher.LearningHelper.SplitWord(AppManager.I.DB, word.Data, false, false);

            if (parts.Count > letterToMark)
            {
                text = LanguageSwitcher.LearningHelper.GetWordWithMarkedLetterText(word.Data, parts[letterToMark], color, MarkType.SingleLetter);
            }
            letter.Init(word, text, 1.3f);
        }
Beispiel #14
0
        ArabicAlphabetHelper.ArabicStringPart RemoveLetterFromQuestion(LL_LetterData letter)
        {
            LL_WordData word = (LL_WordData)m_oCurrQuestionPack.GetQuestion();

            LivingLetterController letterView = m_aoCurrentQuestionScene[0].GetComponent <LetterBehaviour>().mLetter;

            var parts = ArabicAlphabetHelper.FindLetter(AppManager.I.DB, word.Data, letter.Data, true);

            var partToRemove = parts[0];

            letterView.Label.text = ArabicAlphabetHelper.GetWordWithMissingLetterText(word.Data, partToRemove, mk_sRemovedLetterChar);
            return(partToRemove);
        }
        public void SpawnLivingLetter(LL_WordData wordData)
        {
            AdjustForDifficulty();

            var instance = Instantiate(livingLetterPrefab, offscreenPosition, Quaternion.Euler(entranceRotation), this.transform) as GameObject;

            instance.SetActive(true);
            livingLetter = instance.GetComponent <MakeFriendsLivingLetter>();
            livingLetter.Init(wordData);
            livingLetter.container    = this.gameObject;
            livingLetter.focusOnTouch = MakeFriendsGame.Instance.Configuration.Variation == MakeFriendsVariation.HARD ? false : true;

            AdjustForDifficulty();
        }
Beispiel #16
0
        StringPart RemoveLetterFromQuestion(LL_LetterData letter)
        {
            LL_WordData word = (LL_WordData)m_oCurrQuestionPack.GetQuestion();

            LivingLetterController letterView = m_aoCurrentQuestionScene[0].GetComponent <LetterBehaviour>().mLetter;

            bool findSameForm = MissingLetterConfiguration.Instance.Variation == MissingLetterVariation.LetterForm;
            var  parts        = LanguageSwitcher.I.GetHelper(LanguageUse.Learning).FindLetter(AppManager.I.DB, word.Data, letter.Data, findSameForm ? LetterEqualityStrictness.WithActualForm : LetterEqualityStrictness.Letter);
            //Debug.LogWarning("Looking for letter " + letter.Id + " into word " + word.Id);

            var partToRemove = parts[0];

            letterView.LabelRender.text = LanguageSwitcher.I.GetHelper(LanguageUse.Learning).GetWordWithMissingLetterText(word.Data, partToRemove);
            return(partToRemove);
        }
Beispiel #17
0
        public MakeFriendsLivingLetter SpawnLivingLetter(LL_WordData wordData)
        {
            AdjustForDifficulty();

            var instance = Instantiate(livingLetterPrefab, offscreenPosition, Quaternion.Euler(entranceRotation), this.transform) as GameObject;

            instance.SetActive(true);
            livingLetter = instance.GetComponent <MakeFriendsLivingLetter>();
            livingLetter.Init(wordData);
            livingLetter.container = this.gameObject;

            AdjustForDifficulty();

            return(livingLetter);
        }
Beispiel #18
0
        void UpdateQuestion(IQuestionPack questionPack)
        {
            hidePipesTimer      = 0;
            currentQuestionPack = questionPack;
            ResetLetters();

            questionLivingLetter = livingLetters[questionLetterIndex];
            ILivingLetterData correctAnswer = null;

            var correctAnswers = questionPack.GetCorrectAnswers();
            var correctList    = correctAnswers.ToList();

            correctAnswer = correctList[UnityEngine.Random.Range(0, correctList.Count)];

            if (ToboganConfiguration.Instance.Variation == ToboganVariation.SunMoon)
            {
                LL_WordData question = questionPack.GetQuestion() as LL_WordData;

                questionLivingLetter.SetQuestionText(question, 2, ToboganGame.LETTER_MARK_COLOR);
            }
            else
            {
                if (ToboganConfiguration.Instance.Difficulty <= 0.3f)
                {
                    questionLivingLetter.SetQuestionText(questionPack.GetQuestion() as LL_WordData, correctAnswer as LL_LetterData, ToboganGame.LETTER_MARK_COLOR);
                }
                else
                {
                    questionLivingLetter.SetQuestionText(questionPack.GetQuestion());
                }
            }

            var wrongAnswers = questionPack.GetWrongAnswers().ToList();

            // Shuffle wrong answers
            int n = wrongAnswers.Count;

            while (n > 1)
            {
                n--;
                int k     = UnityEngine.Random.Range(0, n + 1);
                var value = wrongAnswers[k];
                wrongAnswers[k] = wrongAnswers[n];
                wrongAnswers[n] = value;
            }

            game.pipesAnswerController.SetPipeAnswers(wrongAnswers, correctAnswer, sunMoonGameVariation);
        }
Beispiel #19
0
        private void Reset()
        {
            commonLetters.Clear();
            choiceLetters.Clear();
            correctChoices.Clear();
            incorrectChoices.Clear();
            wordData1 = null;
            wordData2 = null;
            wordLetters1.Clear();
            wordLetters2.Clear();

            letterPicker.Reset();
            dropZone.Reset();
            leftArea.Reset();
            rightArea.Reset();
        }
Beispiel #20
0
        int RemoveWordfromQuestion(List <LL_WordData> Words, LL_WordData word)
        {
            int index = 0;

            for (; index < Words.Count; ++index)
            {
                if (Words[index].Id == word.Id)
                {
                    break;
                }
            }

            LivingLetterController tmp = m_aoCurrentQuestionScene[index].GetComponent <LetterBehaviour>().mLetter;

            tmp.LabelRender.text = "";
            return(index);
        }
        void SetupLevel()
        {
            currentLevelController = Levels[currentLevel - 1].GetComponent <LevelController>();
            currentWord            = AppManager.I.Teacher.GetRandomTestWordDataLL();

            myLetter.SetActive(true);
            myLetter.GetComponent <MyLetter>().Init(currentWord.Id);
            myLetter.transform.position    = currentLevelController.GetStartPosition().position;
            myLetter.transform.eulerAngles = new Vector3(0, currentLevelController.GetStartPosition().rotation.eulerAngles.y, 0);

            DangerDog.I.Hide();

            // LoggerEA4S.Log("minigame", "dontwakeup", "newWord", currentWord.Data.Arabic);

            currentLevelController.SetWord();
            ChangeCamera(false);
        }
        int RemoveWordfromQuestion(List <LL_WordData> Words)
        {
            LL_WordData word = (LL_WordData)m_oCurrQuestionPack.GetCorrectAnswers().ToList()[0];

            int index = 0;

            for (; index < Words.Count; ++index)
            {
                if (Words[index].Id == word.Id)
                {
                    break;
                }
            }

            LetterObjectView tmp = m_aoCurrentQuestionScene[index].GetComponent <LetterBehaviour>().mLetter;

            tmp.Label.text = "";
            return(index);
        }
Beispiel #23
0
        public void Reset()
        {
            IsIntroducingLetter = false;
            SpokenWords         = 0;

            commonLetters.Clear();
            choiceLetters.Clear();
            correctChoices.Clear();
            incorrectChoices.Clear();
            wordData1 = null;
            wordData2 = null;
            wordLetters1.Clear();
            wordLetters2.Clear();

            letterPicker.Reset();
            dropZone.Reset();
            leftArea.Reset();
            rightArea.Reset();
        }
Beispiel #24
0
        void SelectButton(int buttonNumber, bool userInput = true)
        {
            selectedButton = buttonNumber;

            if (userInput)
            {
                var colorVocabularyData = AppManager.I.DB.GetWordDataById("color_" + m_SelectColorNames[buttonNumber]);
                if (colorVocabularyData != null)
                {
                    var lldata = new LL_WordData(colorVocabularyData);
                    ColorTickleConfiguration.Instance.Context.GetAudioManager().PlayVocabularyData(lldata);
                }
            }

            if (SetBrushColor != null)
            {
                SetBrushColor(m_Buttons[buttonNumber].image.color);
            }
        }
        void RemoveLetterfromQuestion()
        {
            LL_WordData word    = (LL_WordData)m_oCurrQuestionPack.GetQuestion();
            var         Letters = ArabicAlphabetHelper.ExtractLetterDataFromArabicWord(word.Data.Arabic);

            LL_LetterData letter = (LL_LetterData)m_oCurrQuestionPack.GetCorrectAnswers().ToList()[0];
            int           index  = 0;

            for (; index < Letters.Count; ++index)
            {
                if (Letters[index].Id == letter.Id)
                {
                    break;
                }
            }

            LetterObjectView tmp = m_aoCurrentQuestionScene[0].GetComponent <LetterBehaviour>().mLetter;

            tmp.Label.text = tmp.Label.text.Remove(index, 1);
            tmp.Label.text = tmp.Label.text.Insert(index, mk_sRemovedLetterChar);
        }
        public void SetWord(string imageId, LL_WordData wordData)
        {
            if (wordData == null)
            {
                WordTextGO.SetActive(false);
            }
            else
            {
                WordTextGO.SetActive(true);
                WordTextGO.GetComponent <TextRender>().SetLetterData(wordData);
            }

            if (!imageId.IsNullOrEmpty())
            {
                DrawingImageGO.SetActive(true);
                DrawingImageGO.GetComponent <TextMeshProUGUI>().text = imageId;
            }
            else
            {
                DrawingImageGO.SetActive(false);
            }
        }
Beispiel #27
0
        private void SetNewWords()
        {
            wordData1 = null;
            wordData2 = null;
            wordLetters1.Clear();
            wordLetters2.Clear();
            commonLetters.Clear();
            uncommonLetters.Clear();

            var question = GetConfiguration().Questions.GetNextQuestion();

            List <ILivingLetterData> words = question.GetQuestions().ToList();

            wordData1       = words[0] as LL_WordData;
            wordData2       = words[1] as LL_WordData;
            commonLetters   = question.GetCorrectAnswers().ToList();
            uncommonLetters = question.GetWrongAnswers().ToList();

            //Debug.Log($"Word 1: {wordData1.Data}({LanguageSwitcher.LearningHelper.SplitWord(AppManager.I.DB, wordData1.Data, keepFormInsideLetter:true).ConvertAll(x => x.letter).ToJoinedString()}");
            //Debug.Log($"Word 2: {wordData2.Data}({LanguageSwitcher.LearningHelper.SplitWord(AppManager.I.DB, wordData2.Data, keepFormInsideLetter: true).ConvertAll(x => x.letter).ToJoinedString()})");
            //Debug.Log($"Common: {string.Join(" / ", commonLetters.Select(x => x.ToString()).Reverse().ToArray())}, Uncommon: {string.Join(" / ", uncommonLetters.Select(x => x.ToString()).Reverse().ToArray())}");
        }
Beispiel #28
0
        private void SetNewWords()
        {
            wordData1 = null;
            wordData2 = null;
            wordLetters1.Clear();
            wordLetters2.Clear();
            commonLetters.Clear();
            uncommonLetters.Clear();

            var question = GetConfiguration().Questions.GetNextQuestion();

            List <ILivingLetterData> words = question.GetQuestions().ToList();

            wordData1       = words[0] as LL_WordData;
            wordData2       = words[1] as LL_WordData;
            commonLetters   = question.GetCorrectAnswers().ToList();
            uncommonLetters = question.GetWrongAnswers().ToList();

            Debug.Log("[New Round] Word 1: " + ArabicFixer.Fix(wordData1.Data.Arabic) + ", Word 2: " + ArabicFixer.Fix(wordData2.Data.Arabic)
                      + "\nCommon: " + string.Join(" / ", commonLetters.Select(x => x.TextForLivingLetter.ToString()).Reverse().ToArray())
                      + ", Uncommon: " + string.Join(" / ", uncommonLetters.Select(x => x.TextForLivingLetter.ToString()).Reverse().ToArray()));
        }
Beispiel #29
0
        public void SetWord(string imageId, LL_WordData wordData)
        {
            if (wordData == null)
            {
                WordTextGO.SetActive(false);
            }
            else
            {
                WordTextGO.SetActive(true);
                WordTextGO.GetComponent <TextRender>().SetLetterData(wordData);
            }

            if (!imageId.IsNullOrEmpty())
            {
                var imageData = new LL_ImageData(wordData.Id);
                DrawingImageGO.SetActive(true);
                DrawingImageGO.GetComponent <TextRender>().SetLetterData(imageData);
            }
            else
            {
                DrawingImageGO.SetActive(false);
            }
        }
        private IQuestion GenerateMissingLetterQuestion(ILivingLetterData data, ILivingLetterData letterToRemove)
        {
            var           imageData = new LL_ImageData(data.Id);
            LL_WordData   word      = (LL_WordData)data;
            LL_LetterData letter    = (LL_LetterData)letterToRemove;
            var           Letters   = ArabicAlphabetHelper.ExtractLetterDataFromArabicWord(word.Data.Arabic);

            int index = 0;

            for (; index < Letters.Count; ++index)
            {
                if (Letters[index].Id == letter.Id)
                {
                    break;
                }
            }

            var wordGO = LivingLetterFactory.Instance.SpawnQuestion(word);

            wordGO.Label.text = wordGO.Label.text.Remove(index, 1);
            wordGO.Label.text = wordGO.Label.text.Insert(index, RemovedLetterChar);

            return(new ImageQuestion(wordGO, imageData));
        }