quizbutton - eisclimber/ExPresS-XR GitHub Wiki
Class in ExPresSXR.Interaction.ButtonQuiz
Inherits from Button
An expansion of BaseButton representing the Button that is used when answering a TutorialButtonQuiz.
It is able to display answer options in the form of text and GameObject that will hover above the press anchor.
In order to display the GameObjects it is advised to create a Prefab.
Also move them a bit up on the y-axis and if they should be made interactable add a XRGrabInteractable to it.
Most logic is restricted to non-Toggle-Mode as Toggle-Mode is used when the quiz is in MultipleChoice-Mode. If in MultipleChoice-Mode the button will be automatically set to Toggle-Mode and the feedback is handled via an extra (See McConfirmButton).
When pressed the events OnPressedCorrect and OnPressedIncorrect are invoked to notify if the button was pressed correctly or not.
public class QuizButton : Button| Name | Description |
|---|---|
| OnAnsweredCorrect | Invoked via NotifyChoice() when the button was pressed (in non-ToggleMode) and the answer was correct. |
| OnAnsweredIncorrect | Invoked via NotifyChoice() when the button was pressed (in non-ToggleMode) and the answer was not correct. |
| Name | Description |
|---|---|
| ClearAnswer() | Removes any information shown on this button. |
| DisplayAnswer(string,GameObject,bool) | Displays an answer using the provided information and removes the old one. |
| If no information is provided will disable the button. This may only happen | |
| during differing-answers-multiple-choice-quizzes. | |
| GetTriggerTimerValue() | The time in milliseconds since the last reset of the trigger timer. |
| GiveMultipleChoiceFeedback() | Used to find out if the button was toggled correct for a multiple choice quiz. |
| PlayAnsweredCorrectSound() | Plays the answeredCorrectSound, if assigned. |
| PlayAnsweredIncorrectSound() | Plays the answeredIncorrectSound, if assigned. |
| RestartTriggerTimer() | Resets the timer measuring the time until the button was pressed to give an answer. |
Will be automatically called when displaying a new answer (DisplayAnswer() is called). |
| Name | Description |
|---|---|
| AnsweredCorrectSound | Sound played when the button pressed with a correct answer. |
| AnsweredIncorrectSound | Sound played when the button pressed with an incorrect answer. |
| AnswerObject | The prefab that is attached to the feedbackObjectSocket as answer option. |
| AnswerText | The string displayed as the answer. |
| CorrectChoice | If the question currently displayed is correct. |
| FeedbackDisabled | If feedback should be given when pressing the button. |
| InvertedFeedback | If the feedback should be inverted (if feedback is given). |
| OverrideInputDisabledEvents | Used to not emit inputDisabled Events after an answer was given. |