예제 #1
0
        void CheckNavigationButtons()
        {
            QuestionPanelUI panelUI            = questionPanels[currentQuestionIdx];
            bool            nextAvailible      = panelUI.CheckMandatory();
            bool            nextWasInteractive = nextButton.GetComponent <Button>().interactable;

            nextButton.GetComponent <Button>().interactable = nextAvailible;

            backButton.GetComponent <Button>().interactable = true;

            // next button
            if (currentQuestionIdx < questionPanels.Count - 1)
            {
                nextButton.GetComponent <Button>().interactable = nextAvailible;

                if (nextAvailible && !nextWasInteractive)
                {
                    Hashtable ht = new Hashtable();

                    //ht.Add(iT.ScaleBy.looptype,iTween.LoopType.pingPong);
                    ht.Add(iT.ShakeScale.time, 2);

                    iTween.PunchScale(nextButton.gameObject, Vector3.one * 0.25f, 1);
                }
            }
            else
            {
                nextButton.GetComponent <Button>().interactable = false;
            }



            //back button
            if (currentQuestionIdx > 0)
            {
                backButton.GetComponent <Button>().interactable = true;
            }
            else
            {
                backButton.GetComponent <Button>().interactable = false;
            }
        }
예제 #2
0
        void GenerateQuestionnaireUI(Questionnaire questionnaire, UISkinData skin)
        {
            // TODO: Clear UI

            if (studySettings.questionnaireHeaderAs1stQuestion)
            {
                TextViewQuestion textViewQuestion = new TextViewQuestion()
                {
                    id    = "title",
                    title = questionnaire.title,
                    text  = questionnaire.instructions
                };

                var questions = questionnaire.questions.ToList();
                questions.Insert(0, textViewQuestion);
                questionnaire.questions = questions.ToArray();
            }


            foreach (Question question in questionnaire.questions)
            {
                QuestionPanelUI panelUI = GeneratePanelForQuestionType(question.questiontype);
                if (panelUI != null)
                {
                    panelUI.SetQuestion(question, questionnairePanel.OnQuestionAnswered, skin);
                    panelUI.SetQuestionIDVisibility(studySettings.showQuestionId);
                    questionnairePanel.questionPanels.Add(panelUI);
                    panelUI.HidePanel();
                }
            }
            questionnairePanel.Init();



            //Canvas.ForceUpdateCanvases();
            //questionnairePanelUI.contentScrollbarVertical.value = 1;
            //Canvas.ForceUpdateCanvases();
        }