예제 #1
0
    void Start()
    {
        GetComponent <Button>().onClick.AddListener(() =>
        {
            callback();
            PrefabManager.Instance.tbar.GetComponent <TimeController>().PauseTimer();

            string userchoice = desc.text;

            PrefabManager.Instance.destroyQuestionPanel.GetComponent <SentenceQuestionPanelController>().DisplayAnswer(userchoice);

            bool isCorrect = Sentence_DataLoader.CheckAnswer(userchoice);

            if (isCorrect)
            {
                StartCoroutine(StartResultAnimation(true));
            }
            else
            {
                StartCoroutine(StartResultAnimation(false));
            }
            //Sentence_DataLoader.Sentence_SetRecord(isCorrect);
            Debug.Log("<color=yellow>" + isCorrect + "</color>");
        });
    }
예제 #2
0
    public void DisplayAnswer(string userchoice)
    {
        string q = Sentence_DataLoader.GetCurrentUserChoiceQuestion(userchoice);
        var    t = transform.Find("QuestionBG").transform.Find("Question").GetComponent <Text>();

        t.text = q;
        if (Sentence_DataLoader.CheckAnswer(userchoice))
        {
            StartCoroutine(BounceScaleAnimation());
        }
        else
        {
            transform.DOShakePosition(0.2f, 20f, 50);
        }
    }