Exemplo n.º 1
0
 void OnMultiFieldSubmit(string input)
 {
     question.isAnswered       = true;
     multiFieldQuestion.answer = input;
     print(question.id + " " + multiFieldQuestion.answer);
     OnQuestionAnswered.Invoke(question);
 }
 void OnDropDownValueChanged(int itemId)
 {
     question.isAnswered = true;
     downQuestion.answer = downQuestion.items[itemId];
     print(question.id + " " + downQuestion.answer);
     OnQuestionAnswered.Invoke(question);
 }
Exemplo n.º 3
0
        void OnItemSelected(Toggle toggle, string qId, bool value)
        {
            for (int i = 0; i < questionItems.Count; i++)
            {
                List <Toggle> toggles = questionItems[i];
                int           idx     = toggles.IndexOf(toggle);
                if (idx >= 0)
                {
                    for (int j = 0; j < toggles.Count; j++)
                    {
                        toggles[j].SetIsOnWithoutNotify(false);
                    }
                    toggle.SetIsOnWithoutNotify(true);
                    break;
                }
            }
            int counter = 0;

            for (int i = 0; i < questionItems.Count; i++)
            {
                for (int j = 0; j < questionItems[i].Count; j++)
                {
                    if (questionItems[i][j].isOn)
                    {
                        radioGridQuestion.answers[i] = j;
                        counter++;
                    }
                }
            }
            if (counter == questionItems.Count)
            {
                radioGridQuestion.isAnswered = true;
                OnQuestionAnswered.Invoke(question);
            }
        }
Exemplo n.º 4
0
 void OnFieldSubmited(string value)
 {
     question.isAnswered  = true;
     fieldQuestion.answer = value;
     print(question.id + " " + fieldQuestion.answer);
     OnQuestionAnswered.Invoke(question);
 }
Exemplo n.º 5
0
 void OnSliderValueChanged(float value)
 {
     question.isAnswered   = true;
     sliderQuestion.answer = value;
     //print(question.id + " " + sliderQuestion.answer);
     valueLabel.text = slider.value.ToString();
     OnQuestionAnswered.Invoke(question);
 }
Exemplo n.º 6
0
 void HandleToggleValueChanged(bool arg0)
 {
     question.isAnswered = true;
     for (int i = 0; i < checkQuestion.answers.Length; i++)
     {
         checkQuestion.answers[i] = toggles[i].isOn;
         print("answered: " + i + " item: " + toggles[i].isOn);
     }
     OnQuestionAnswered.Invoke(question);
 }
 public void Submit()
 {
     if (question != null)
     {
         question.isAnswered = true;
     }
     if (OnQuestionAnswered != null)
     {
         OnQuestionAnswered.Invoke(question);
     }
 }
Exemplo n.º 8
0
        void OnItemSelected(Toggle toggle, string qId, bool value)
        {
            int idx = toggles.IndexOf(toggle);

            foreach (Toggle t in toggles)
            {
                t.SetIsOnWithoutNotify(false);
            }
            toggle.SetIsOnWithoutNotify(true);
            radioListQuestion.answer     = idx;
            radioListQuestion.isAnswered = true;

            print("answered: " + qId + " item: " + idx);
            OnQuestionAnswered.Invoke(question);
        }
Exemplo n.º 9
0
        void OnNumFieldSubmitted(string input)
        {
            bool validAnswer = false;

            switch (question.datatype)
            {
            case QuestionDataType.Integer:
                int ivalue;
                if (int.TryParse(input, out ivalue))
                {
                    if (ivalue < numFieldQuestion.min)
                    {
                        ivalue = (int)numFieldQuestion.min;
                    }
                    else if (ivalue > numFieldQuestion.max)
                    {
                        ivalue = (int)numFieldQuestion.max;
                    }
                    validAnswer     = true;
                    inputField.text = ivalue.ToString();
                }
                numFieldQuestion.answer = ivalue;
                break;

            case QuestionDataType.Float:
                float fvalue;
                if (float.TryParse(input, out fvalue))
                {
                    if (fvalue < numFieldQuestion.min)
                    {
                        fvalue = numFieldQuestion.min;
                    }
                    else if (fvalue > numFieldQuestion.max)
                    {
                        fvalue = numFieldQuestion.max;
                    }
                    validAnswer     = true;
                    inputField.text = fvalue.ToString();
                }
                numFieldQuestion.answer = fvalue;
                break;
            }
            question.isAnswered = validAnswer;
            if (validAnswer)
            {
                OnQuestionAnswered.Invoke(numFieldQuestion);
            }
        }
Exemplo n.º 10
0
        //private void NumberPad_OnConfirm()
        //{
        //	OnNumFieldSubmitted(inputField.text);
        //}

        private void NumberPad_OnNumberSelected(int number)
        {
            inputField.text += number.ToString();
            OnQuestionAnswered.Invoke(this.question);
            OnNumFieldSubmitted(inputField.text);
        }