Ejemplo n.º 1
0
        public void Visit(LadderQuestion q)
        {
            var ladder = GameObjectUtils.InstatiatePrefab("Prefabs/Menus/Questionnaire/Content/LadderContent");

            _customContent = ladder.transform;
            MenuUtils.PlaceElement(ladder, _questionContent);

            _dynamicFieldsWithScrollbar.gameObject.SetActive(false);

            _customContent.Find("LadderLabel").gameObject.GetComponent <Text>().text = q.LadderText;
            var ladderButtons = _customContent.Find("LadderGroup").Find("Buttons");

            var qmb = _questionPlaceholder.GetComponent <QuestionMenuButtons>();

            for (var i = 9; i >= 0; i--)
            {
                var btn = ladderButtons.Find("ToggleButtons" + i).GetComponent <Toggle>();

                var iLocal = i;
                btn.onValueChanged.AddListener(isOn =>
                {
                    qmb.SetAnswerInt(iLocal, isOn ? 1 : 0);
                });
                btn.isOn = _oldAnswers != null && _oldAnswers.ContainsKey(i);
            }
        }
Ejemplo n.º 2
0
        public void LoadFromDatabase(LoggingManager log)
        {
            var qDataList = log.GetQuestionSetContent(Name);

            foreach (var questionData in qDataList)
            {
                Question q;
                switch ((Enums.Question)questionData.QuestionType)
                {
                case Enums.Question.Info:
                    q = new InfoScreen(questionData);
                    break;

                case Enums.Question.Text:
                    q = new TextQuestion(questionData);
                    break;

                case Enums.Question.Choice:
                    q = new ChoiceQuestion(questionData);
                    break;

                case Enums.Question.Scale:
                    q = new ScaleQuestion(questionData);
                    break;

                case Enums.Question.Ladder:
                    q = new LadderQuestion(questionData);
                    break;

                case Enums.Question.Stimuli:
                    q = new VisualStimuli(questionData);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                q.Jumps = log.GetJumps(questionData);
                Questions.Add(q);
            }
        }