Class QuestionnaireController
The QuestionaireController provides the functionality to control the input field questions, reqular question and question lists. The input field question opens the keyboard and recives any given string input from the user. The regular question opens a question with up to four possible pre-defined awnsers. The question list opens a list with n possible items and continues when all right items were selected.
Inheritance
Namespace: UI
Assembly: Assembly-CSharp.dll
Syntax
public class QuestionnaireController : MonoBehaviour
Fields
| Improve this Doc View SourceButtonBlueprint
Reference to the AnswerButtonPrefab.
Declaration
public Button ButtonBlueprint
Field Value
Type | Description |
---|---|
Button | Set in inspector. |
buttons
References to the Buttons
Declaration
public List<Button> buttons
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<Button> | Set in inspector. |
correctAnswerColor
Color for correct answers.
Declaration
public Color correctAnswerColor
Field Value
Type | Description |
---|---|
Color | Default set in inspector. |
correctAnswerSound
Audioclip that is played when correct answer is pressed.
Declaration
public AudioClip correctAnswerSound
Field Value
Type | Description |
---|---|
AudioClip | Default is set in inspector. |
defaultUIColor
Color for unpressed buttons.
Declaration
public Color defaultUIColor
Field Value
Type | Description |
---|---|
Color | Default set in inspector. |
duration
How long it takes to fade in the UI.
Declaration
public float duration
Field Value
Type | Description |
---|---|
System.Single | Default is 1.0f seconds. |
inputFieldAnswerText
Reference to the inputFieldAnswerText.
Declaration
public TextMeshProUGUI inputFieldAnswerText
Field Value
Type | Description |
---|---|
TextMeshProUGUI | Set in inspector. |
inputFieldQuestionText
Reference to the inputFieldQuestionText.
Declaration
public TextMeshProUGUI inputFieldQuestionText
Field Value
Type | Description |
---|---|
TextMeshProUGUI | Set in inspector. |
inputFieldQuestionUI
Reference to the root gameObject of the inputFieldUI.
Declaration
public GameObject inputFieldQuestionUI
Field Value
Type | Description |
---|---|
GameObject | Set in inspector. |
questionList
Reference to the root of the question list UI.
Declaration
public GameObject questionList
Field Value
Type | Description |
---|---|
GameObject | Set in inspector. |
questionListQuestionText
Reference to the QuestionListText.
Declaration
public TextMeshProUGUI questionListQuestionText
Field Value
Type | Description |
---|---|
TextMeshProUGUI | Set in inspector. |
questionnaireUIRectTransform
Reference to the UIRectTransform.
Declaration
public RectTransform questionnaireUIRectTransform
Field Value
Type | Description |
---|---|
RectTransform | Set in inspector. |
questionText
Reference to the questionText.
Declaration
public TextMeshProUGUI questionText
Field Value
Type | Description |
---|---|
TextMeshProUGUI | Set in inspector. |
questionTextUI
Reference to the questionText.
Declaration
public GameObject questionTextUI
Field Value
Type | Description |
---|---|
GameObject | Set in inspector. |
regularQuestionUI
Reference to the root gameObject of the regularQuestionUI.
Declaration
public GameObject regularQuestionUI
Field Value
Type | Description |
---|---|
GameObject | Set in inspector. |
responseText
Reference to the ResponseText.
Declaration
public GameObject responseText
Field Value
Type | Description |
---|---|
GameObject | Set in inspector. |
rightAnswer
Stores right answers for endscreen UI.
Declaration
public List<string> rightAnswer
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | Set on runtime. |
wrongAnswerColor
Color for wrong answers.
Declaration
public Color wrongAnswerColor
Field Value
Type | Description |
---|---|
Color | Default set in inspector. |
wrongAnsweredQuestions
Stores wrong answered questions for endscreen UI.
Declaration
public List<string> wrongAnsweredQuestions
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | Set on runtime. |
wrongAnswers
Stores wrong answers for endscreen UI.
Declaration
public List<string> wrongAnswers
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | Set on runtime. |
wrongAnswerSound
Audioclip that is played when wrong answer is pressed.
Declaration
public AudioClip wrongAnswerSound
Field Value
Type | Description |
---|---|
AudioClip | Default is set in inspector. |
Methods
| Improve this Doc View SourceContinueButtonOnClick()
Get's called when the continue button is pressed. When the chosen answer was correct, the statemachine gets notified. When the chosen answer was wrong, the question gets displayed again.
Declaration
public void ContinueButtonOnClick()
InitInputfield(String)
Open the inputField question UI.
Declaration
public void InitInputfield(string question)
Parameters
Type | Name | Description |
---|---|---|
System.String | question | Text of the question. |
InitQuestion(String, List<QuestionnaireController.Answer>)
Open the regular question UI.
Declaration
public void InitQuestion(string question, List<QuestionnaireController.Answer> answers)
Parameters
Type | Name | Description |
---|---|---|
System.String | question | Text of the question. |
System.Collections.Generic.List<QuestionnaireController.Answer> | answers | List of all possible answers. |
InitQuestionList(String, List<QuestionnaireController.Answer>)
Open the questionList UI.
Declaration
public void InitQuestionList(string question, List<QuestionnaireController.Answer> answers)
Parameters
Type | Name | Description |
---|---|---|
System.String | question | Text of the question. |
System.Collections.Generic.List<QuestionnaireController.Answer> | answers | List of all possbile answers. |
NotifyStatemachine(String, QuestionnaireController.QuestionUITypes)
Notify the statemachine with the result of the question UI.
Declaration
public void NotifyStatemachine(string value, QuestionnaireController.QuestionUITypes type = QuestionnaireController.QuestionUITypes.Question)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | Result in text form. |
QuestionnaireController.QuestionUITypes | type | Type of question. |
QuestionInputValidate()
Validate if given input of the inputQuestion UI was correct.
Declaration
public void QuestionInputValidate()