Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void SetGreenLetter(ILivingLetterData word, ILivingLetterData letter)
        {
            var wordInner   = word as LL_WordData;
            var letterInner = letter as LL_LetterData;

            var parts = ArabicAlphabetHelper.FindLetter(AppManager.I.DB, wordInner.Data, letterInner.Data, false);

            var partToRemove = parts[0];

            // .. and voil�! Thank you Davide! :)
            Label.text = ArabicTextUtilities.GetWordWithMarkedLetterText(
                wordInner.Data, partToRemove, SpecialGreen, ArabicTextUtilities.MarkType.SingleLetter
                );
        }
Exemplo n.º 4
0
        public void OnCorrectLetterHit(LetterController correctLetterCntrl)
        {
            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.BuildWord)
            {
                numLettersRemaining--;
                var word = ((LL_WordData)question).Data;

                if (flashingTextCoroutine != null)
                {
                    ThrowBallsGame.instance.StopCoroutine(flashingTextCoroutine);
                }

                if (numLettersRemaining == 0)
                {
                    string markedText = ArabicTextUtilities.GetWordWithMarkedText(word, Color.green);
                    UIController.instance.SetText(markedText);
                }
                else
                {
                    var letterToFlash = (LL_LetterData)currentLettersForLettersInWord[currentLettersForLettersInWord.Count - numLettersRemaining];
                    int numTimesLetterHasBeenFlashed = flashedLettersInLiWVariation.Count(x => x.Id == letterToFlash.Id);
                    var letterDataToFlash            = ArabicAlphabetHelper.FindLetter(AppManager.I.DB, word, letterToFlash.Data, false)[numTimesLetterHasBeenFlashed];
                    flashedLettersInLiWVariation.Add(letterToFlash);

                    flashingTextCoroutine = ArabicTextUtilities.GetWordWithFlashingText(word, letterDataToFlash.fromCharacterIndex, letterDataToFlash.toCharacterIndex, Color.green, FLASHING_TEXT_CYCLE_DURATION, int.MaxValue,
                                                                                        (string text) => {
                        UIController.instance.SetText(text);
                    }, true);

                    ThrowBallsGame.instance.StartCoroutine(flashingTextCoroutine);
                }

                UIController.instance.WobbleLetterHint();

                if (numLettersRemaining != 0)
                {
                    UpdateLettersForLettersInWord(correctLetterCntrl);
                    BallController.instance.DampenVelocity();
                }
                else
                {
                    OnRoundWon(correctLetterCntrl);
                }
            }
            else
            {
                OnRoundWon(correctLetterCntrl);
            }
        }
Exemplo n.º 5
0
        public void OnCorrectLetterHit(LetterController correctLetterCntrl)
        {
            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.BuildWord)
            {
                numLettersRemaining--;
                var word = ((LL_WordData)question).Data;

                if (flashingTextCoroutine != null)
                {
                    ThrowBallsGame.instance.StopCoroutine(flashingTextCoroutine);
                }

                if (numLettersRemaining == 0)
                {
                    string markedText = ArabicTextUtilities.GetWordWithMarkedText(word, Color.green);
                    UIController.instance.SetText(markedText);
                }
                else
                {
                    var letterToFlash = (LL_LetterData)currentLettersForLettersInWord[currentLettersForLettersInWord.Count - numLettersRemaining];

                    FlashLetter(letterToFlash);

                    ThrowBallsGame.instance.StartCoroutine(flashingTextCoroutine);
                }

                UIController.instance.WobbleLetterHint();

                if (numLettersRemaining != 0)
                {
                    UpdateLettersForLettersInWord(correctLetterCntrl);
                    BallController.instance.DampenVelocity();
                }
                else
                {
                    OnRoundWon(correctLetterCntrl);
                }
            }
            else
            {
                OnRoundWon(correctLetterCntrl);
            }
        }
Exemplo n.º 6
0
        private void FlashLetter(LL_LetterData letterToFlash)
        {
            var word = ((LL_WordData)question).Data;
            int numTimesLetterHasBeenFlashed = flashedLettersInLiWVariation.Count(x => x.Id == letterToFlash.Id);
            var letterPartToFlash            = ArabicAlphabetHelper.FindLetter(AppManager.I.DB, word, letterToFlash.Data, false)[numTimesLetterHasBeenFlashed];

            flashedLettersInLiWVariation.Add(letterToFlash);

            int toCharIndex = letterPartToFlash.toCharacterIndex;

            if (letterPartToFlash.fromCharacterIndex != letterPartToFlash.toCharacterIndex)
            {
                var hexCode = ArabicAlphabetHelper.GetHexUnicodeFromChar(word.Arabic[letterPartToFlash.toCharacterIndex]);
                if (hexCode == "0651")   // Shaddah
                {
                    toCharIndex -= 1;
                }
            }

            flashingTextCoroutine = ArabicTextUtilities.GetWordWithFlashingText(word, letterPartToFlash.fromCharacterIndex, toCharIndex, Color.green, FLASHING_TEXT_CYCLE_DURATION, int.MaxValue,
                                                                                text => {
                UIController.instance.SetText(text);
            }, true);
        }
Exemplo n.º 7
0
        public IEnumerator StartNewRound_LettersInWord()
        {
            IQuestionPack newQuestionPack = ThrowBallsConfiguration.Instance.Questions.GetNextQuestion();

            currentLettersForLettersInWord = newQuestionPack.GetCorrectAnswers().ToList();

            numLettersRemaining = currentLettersForLettersInWord.Count;

            ResetScene();

            List <int> sortedIndices = SortLettersByZIndex(currentLettersForLettersInWord.Count);

            if (!uiInitialised && !IsTutorialRound())
            {
                uiInitialised = true;
                game.Context.GetOverlayWidget().Initialize(true, false, true);
                game.Context.GetOverlayWidget().SetStarsThresholds(1, 3, 5);
                game.Context.GetOverlayWidget().SetMaxLives(MAX_NUM_BALLS);
            }

            question = newQuestionPack.GetQuestion();
            SayQuestion();

            yield return(new WaitForSeconds(1f));

            UIController.instance.Enable();
            UIController.instance.EnableLetterHint();
            UIController.instance.SetLivingLetterData(question);

            var letterToFlash = (LL_LetterData)currentLettersForLettersInWord[0];

            var letterDataToFlash = ArabicAlphabetHelper.FindLetter(AppManager.I.DB, ((LL_WordData)question).Data, letterToFlash.Data, false)[0];

            flashingTextCoroutine = ArabicTextUtilities.GetWordWithFlashingText(((LL_WordData)question).Data, letterDataToFlash.fromCharacterIndex, letterDataToFlash.toCharacterIndex, Color.green, FLASHING_TEXT_CYCLE_DURATION, int.MaxValue,
                                                                                (string text) => {
                UIController.instance.SetText(text);
            }, false);

            flashedLettersInLiWVariation.Add(letterToFlash);

            ThrowBallsGame.instance.StartCoroutine(flashingTextCoroutine);

            for (int i = 0; i < currentLettersForLettersInWord.Count; i++)
            {
                int        letterObjectIndex = game.Difficulty <= ThrowBallsGame.ThrowBallsDifficulty.Easy ? sortedIndices[i] : i;
                GameObject letterObj         = letterPool[letterObjectIndex];

                letterObj.SetActive(true);

                ConfigureLetterPropAndMotionVariation(letterControllers[letterObjectIndex]);

                letterControllers[letterObjectIndex].SetLetter(currentLettersForLettersInWord[i]);
                letterObj.tag = currentLettersForLettersInWord[i].Id == currentLettersForLettersInWord[0].Id ? Constants.CORRECT_LETTER_TAG : Constants.WRONG_LETTER_TAG;

                if (i == 0)
                {
                    tutorialTarget = letterObj;
                }
            }

            isRoundOngoing = true;

            BallController.instance.Enable();

            if (IsTutorialRound())
            {
                switch (ThrowBallsConfiguration.Instance.Variation)
                {
                case ThrowBallsVariation.LetterName:
                    audioManager.PlayDialogue(Database.LocalizationDataId.ThrowBalls_lettername_Tuto);
                    break;

                case ThrowBallsVariation.LetterAny:
                    audioManager.PlayDialogue(Database.LocalizationDataId.ThrowBalls_lettername_Tuto);
                    break;

                case ThrowBallsVariation.Word:
                    audioManager.PlayDialogue(Database.LocalizationDataId.ThrowBalls_word_Tuto);
                    break;

                case ThrowBallsVariation.BuildWord:
                    audioManager.PlayDialogue(Database.LocalizationDataId.ThrowBalls_buildword_Tuto);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                inputManager.Enabled = true;
                isVoiceOverDone      = true;
                ShowTutorialUI();
            }
        }