Example #1
0
    private void BuildTask(int current)
    {
        buttonsHandler.ClearTextInButtons();

        if (trainingСompleted || questions.Count == 0)
        {
            GameManager.Notifications.PostNotification(this, GAME_EVENTS.WordsEnded);
            return;
        }

        questionID = FindNodeByID(current);
        if (questionID < 0)
        {
            Debug.LogError(this + "отсутствует или указан неверно идентификатор узла.");
            return;
        }

        int toNode = questionID + 1;

        if (questions.Count <= toNode)
        {
            toNode            = 0;
            trainingСompleted = true;
        }

        QuestionLeo questionLeo = questions[questionID];

        // добавление слова для перевода
        string questionWord = questionLeo.questWord.wordValue;

        SetQuestion(questionWord);
        SetTranscript(questionLeo.questWord.transcription);

        //TODO: заполнять все кнопки одновременно
        List <string> answers = new List <string>(ANSWER_COUNT);

        foreach (WordLeo item in questionLeo.answers)
        {
            answers.Add(item.wordValue);
        }

        buttonsHandler.FillingButtonsWithOptions(answers, questionWord);
        buttonsHandler.FillingEnterButton(true);

        SetImage(questionLeo.questWord.pictureURL);
        SetSound(questionLeo.questWord.soundURL);
        SetContext(questionLeo.questWord.highlightedContext);
        HideContext();

        // выбор окна диалога как активного, чтобы снять выделение с кнопок диалога
        EventSystem.current.SetSelectedGameObject(this.gameObject);
        GameManager.Notifications.PostNotification(this, GAME_EVENTS.BuildTask);
    }
Example #2
0
 public void SetButtons(List <string> answers, string questWord)
 {
     buttonsHandler.FillingButtonsWithOptions(answers, questWord);
     buttonsHandler.FillingEnterButton(true);
 }