예제 #1
0
        public override void SetQuestion(Question q, UnityAction <Question> answeredEvent, UISkinData skinData)
        {
            base.SetQuestion(q, answeredEvent, skinData);
            multiFieldQuestion    = question as MultiFieldQuestion;
            instructionsText.text = question.instructions;
            idText.text           = question.id;

            placeholder.text = multiFieldQuestion.placeholder;

            inputField.onSubmit.AddListener(OnMultiFieldSubmit);
            inputField.onDeselect.AddListener(OnMultiFieldSubmit);
        }
예제 #2
0
        Question GenerateQuestion(JSONObject json)
        {
            print("question:" + json.ToString());
            string questiontype = json["questiontype"].Str;

            Question question = null;

            switch (questiontype)
            {
            case QuestionTypeNames.radiogrid:
                question = new RadioGridQuestion(json);
                break;

            case QuestionTypeNames.radiolist:
                question = new RadioListQuestion(json);
                break;

            case QuestionTypeNames.checklist:
                question = new CheckListQuestion(json);
                break;

            case QuestionTypeNames.slider:
                question = new SliderQuestion(json);
                break;

            case QuestionTypeNames.field:
                question = new FieldQuestion(json);
                break;

            case QuestionTypeNames.num_field:
                question = new NumFieldQuestion(json);
                break;

            case QuestionTypeNames.multi_field:
                question = new MultiFieldQuestion(json);
                break;

            case QuestionTypeNames.drop_down:
                question = new DropDownQuestion(json);
                break;

            case QuestionTypeNames.textview:
                question = new TextViewQuestion(json);
                break;

            default:
                question = new TextViewQuestion(json);
                break;
            }
            return(question);
        }