Esempio n. 1
0
    public void SetButton(string text, Sprite image = null)
    {
        gameObject.SetActive(true);
        toggle.isOn = false;
        coverImage.gameObject.SetActive(false);
        if (Fa.isFarsi(text[0]))
        {
            buttonText.text = text.faConvert();
        }
        else
        {
            buttonText.text = text;
        }

        if (image != null)
        {
            if (buttonImage != null)
            {
                buttonImage.sprite = image;
            }
            else
            {
                Debug.LogError("Image component not found!!!");
            }
        }
    }
Esempio n. 2
0
    private bool IsPersianQuestion(string text)
    {
        for (int i = 0; i < text.Length; i++)
        {
            if (Fa.isFarsi(text[i]))
            {
                return(true);
            }
        }

        return(false);
    }
Esempio n. 3
0
    public void SelectedButtonChange(int index)
    {
        if (index != selectedAnswerIndex)
        {
            selectedAnswerIndex = index;

            string temp = QuestionList[CurrentQuestionIndex].options[index - 1];
            if (temp != string.Empty && !Fa.isFarsi(temp[0]))
            {
                Setting.Speak(temp);
            }
        }
    }
    public void SetQuestion()
    {
        if (question.Title != string.Empty)
        {
            if (Fa.isFarsi(question.Title[0]))
            {
                titleQuestionText.lineSpacing = -1;
                titleQuestionText.text        = question.Title.faConvert();
            }
            else
            {
                titleQuestionText.lineSpacing = 1;
                titleQuestionText.text        = question.Title;
            }
        }

        selectedStringText.text = "";
        foreach (var item in lines)
        {
            item.HideLine();
        }
        wordGameSize = (int)question.wordGameSize;

        for (int i = 0; i < maxLines; i++)
        {
            if (i < wordGameSize)
            {
                lines[i].ShowEmptyLine(wordGameSize);
            }
            else
            {
                lines[i].HideLine();
            }
        }

        for (int i = 0; i < question.words.Length; i++)
        {
            List <Vector2> currentWordPosition = GetWordPositions(i);
            for (int j = 0; j < currentWordPosition.Count; j++)
            {
                lines[(int)Mathf.Round(currentWordPosition[j].y)].ShowChar(question.words[i][j], (int)Mathf.Round(currentWordPosition[j].x), i);
            }
        }
    }