-
-
Notifications
You must be signed in to change notification settings - Fork 2
Button Quiz
class in ExPresSXR.Interaction.ButtonQuiz / Extends MonoBehavior
Use SetupDialog at "ExPresS XR/Button Quiz Setup" to create
Represents a configurable quiz where answers are given by pressing buttons.
It is advised to create and edit the quiz and config exclusively via SetupDialog at ExPresS XR/Tutorial Button Quiz.
A detailed description of the config can be found at QuizConfig
.
If the answers allow the type GameObject and those Game Objects are GrabInteractables
they can be picked up.
When used together with the DataGatherer
most information can be exported using the CSV-save getter-methods.
Selecting one of the *ExportValues()
-functions will automatically set the correct header for the DataGatheringBinding
.
The trigger for exporting should be the ButtonQuiz.OnAnswerGiven
-Event, calling the DataGatherer
's ExportNewCSVLine()
-method.
-
bool _startOnAwake
: If true the Quiz will be started on awake. Else it can be started by callingStartQuiz
or via the inspector. -
string _showQuizCompletedText
: Displays theDEFAULT_QUIZ_COMPLETED_TEXT
-text in the_displayText
if possible after the quiz was completed. Does not require an_afterQuizMenu
. -
bool _canRestartFromAfterQuizDialog
: Allows restarting the quiz in the AfterQuizMenu ifafterQuizMenu
is set and it contains a Button with the name "Restart Button". -
float _feedbackDuration
: Duration the feedback is shown. Default:DEFAULT_FEEDBACK_DURATION
-
QuizConfig config
: The ButtonQuizConfig that hold all question and general config to be exported. -
float quizUndergoing
: (Readonly) Can be used to check if a quiz is currently undergoing. -
ButtonQuizQuestion[] questions
: (Readonly) Reference to the questions of the quiz. Requires the quiz to be set up. -
int numQuestions
: (Readonly) Number of questions of the quiz. Requires the quiz to be set up. -
int[] questionPermutation
: (Readonly) Permutation for the question of the current playthrough of the quiz. Requires the quiz to be set up. -
int currentQuestionIdx
: (Readonly) Index of the current question relative the the un-permuted question array. Requires the quiz to be set up. -
ButtonQuizQuestion currentQuestion
: (Readonly) Reference to the current question. Requires the quiz to be set up and started. -
int[] currentAnswerPermutation
: (Readonly) Permutation of the answers of the current question. Requires the quiz to be set up and started. -
QuizRoundData latestRoundData
: (Readonly) Information about the latest question answered. Requires the quiz to be set up and one answer to be given. -
long quizStartTime
: (Readonly) Start (Unix-)time of the current playthrough. Requires the quiz to be set up. -
int quizPlaythroughNumber
: (Readonly) How often the quiz was played since the app was started. -
QuizButton[] _buttons
: An array containing all required QuizButtons (not the McConfirmButton). The required amount of buttons is determined by the amount of answer of the config. -
McConfirmButton _mcConfirmButton
: A McConfirmButton that is used to confirm a choice. Only required when the quiz is Multiple Choice. -
TMP_Text displayText
: A TMP_Text that is used to display all text questions and text feedback. Required when text is used for feedback or questions. -
Transform displayAnchor
: A Transform that is used as an attach point for all question and feedback GameObjects. Required when GameObjects are used for feedback or questions. -
VideoPlayer displayPlayer
: The VideoPlayer handling videos. Required when videos should be played as feedback or questions. -
VideoPlayer displayPlayer
: The RawImage used to display the videos played. Required when videos should be played as feedback or questions. -
Canvas afterQuizMenu
: A Canvas that is shown after the whole quiz was completed. Automatically sets up Buttons called "Close Button" to close this menu and Buttons called "Restart Button" to restart the quiz if_canRestartFromAfterQuizDialog
is set.
-
void StartQuiz()
: May be used to (re-)start the quiz if setup correctly. Calling the method will trigger theOnAnswerGiven
-UnityEvent. -
void StopQuiz()
: May be used to stop the quiz at any time. Calling the method will trigger theOnQuizCompleted
-UnityEvent. -
bool IsSetupValid(QuizSetupConfig config, AutoXRQuizButton[] buttons, AutoXRMcConfirmButton mcConfirmButton, TMP_Text displayText, Transform displayAnchor, VideoPlayer displayPlayer, Canvas afterQuizDialog)
: Evaluates and sets everything up for the quiz to be started. Will be called automatically when an quiz is started. -
float GetQuizUnixStartTime()
: Gets the UNIX-timestamp of the start of the quiz. -
float GetCurrentQuizUnixTimeMillisecondsDuration()
: Gets the duration of how long the quiz is currently running in milliseconds. If it is not running-1.0f
is returned. -
int GetCurrentQuestionIdx()
: Gets the index of the current question (not the latest answered) specified in the config (i.e.QuizQuestion.itemIdx
). Is only same asGetCurrentQuestionNumber()
if questions are not shuffled. -
int GetCurrentAskOrderIdx()
: Gets the index of the current question (not the latest answered) relative to the question permutation. -
string GetLatestRoundDataExportValues(char sep = CsvUtility.DEFAULT_COLUMN_SEPARATOR)
: (MultiColumnValue & HeaderReplacement) Returns csv-values of the latest answered question.
The header is:answerWasCorrect,answerChosen,firstPressedButtonIdx,answerPressTime,askOrderIdx,answerPermutation,displayedFeedbackText,displayedFeedbackObjects,displayedFeedbackVideo,questionIdx,questionVideo,questionObject,questionText,answerObject0,answerObject1,answerObject2,answerObject3,answerText0,answerText1,answerText2,answerText3,correctAnswers0,correctAnswers1,correctAnswers2,correctAnswers3,feedbackVideo,feedbackObject,feedbackText
-
List<object> GetLatestRoundDataExportValueList()
: Returns a list of objects of the latest answered question. -
string GetFullQuizCsvExportValues(char sep = CsvUtility.DEFAULT_COLUMN_SEPARATOR)
: (MultiColumnValue & HeaderReplacement) Returns csv-values containing all important values of the quiz. The header is:quizUndergoing,quizPlaythroughNumber,answerWasCorrect,answerChosen,firstPressedButtonIdx,answerPressTime,askOrderIdx,answerPermutation,displayedFeedbackText,displayedFeedbackObjects,displayedFeedbackVideo,questionIdx,questionVideo,questionObject,questionText,answerObject0,answerObject1,answerObject2,answerObject3,answerText0,answerText1,answerText2,answerText3,correctAnswers0,correctAnswers1,correctAnswers2,correctAnswers3,feedbackVideo,feedbackObject,feedbackText,quizMode,questionOrdering,answersAmount,answersOrdering,questionType,answerType,feedbackMode,feedbackType
-
List<object> GetFullQuizCsvExportValuesList()
: Returns a list of objects containing all important values of the quiz. -
string GetConfigCsvExportValues(char sep = CsvUtility.DEFAULT_COLUMN_SEPARATOR)
: (MultiColumnValue & HeaderReplacement) Returns the export values config currently used. If none was set, empty columns will be returned.
The header is:"quizMode,questionOrdering,answersAmount,answersOrdering,questionType,answerType,feedbackMode,feedbackType"
-
List<object> GetConfigCsvExportValuesList()
: Returns the export values config as list of objects. If none was set, a list of the same size will be returned. -
string GetAllQuestionsCsvExportValues(char sep = CsvUtility.DEFAULT_COLUMN_SEPARATOR)
: (MultiColumnValue & HeaderReplacement) Returns multi-line csv-string for exporting all questions of the quiz.
The header is:"questionIdx,questionVideo,questionObject,questionText,answerObject0,answerObject1,answerObject2,answerObject3,answerText0,answerText1,answerText2,answerText3,correctAnswers0,correctAnswers1,correctAnswers2,correctAnswers3,feedbackVideo,feedbackObject,feedbackText"
-
string GetQuestionPermutationAsCsvString()
: Returns the current question permutation as string.
-
string GetFullQuizCsvHeader(char sep = CsvUtility.DEFAULT_COLUMN_SEPARATOR)
: Returns the csv-header for the values returned byGetFullQuizCsvExportValues()
as list of objects. -
List<object> GetFullQuizCsvHeaderList()
: Returns the csv-header for the values returned byGetFullQuizCsvExportValues()
as a list of strings.
-
OnQuizStarted
: Will be emitted when the quiz is (re-)started. -
OnAnswerGiven
: Will be emitted when an answer was given. -
OnQuizCompleted
: Will be emitted when the quiz was completed or stopped manually by callingStopQuiz()
.
-
int MIN_QUESTIONS = 1
: The minium number of questions possible for a quiz. -
int NUM_ANSWERS = 4
: Maximal number of answers in a quiz (and default size of most arrays). -
float DISPLAY_OBJECTS_SPACING = 0.5f
: Unity Units of the spacing when multiple GameObjects are displayed in the DisplayAnchor. -
DEFAULT_FEEDBACK_DURATION = 3.0f
: Default duration in seconds the feedback is shown. -
DEFAULT_QUIZ_COMPLETED_TEXT
: The text that (if enabled) will be shown after the quiz was completed. -
int NUM_CSV_EXPORT_COLUMNS
: Number of csv-columns of values returned the export functions.
Autor: Luca 'eisclimber' Dreiling; License: MIT
- Getting Started
- Development and Contribution
- Misc
- Experimentation
- Data Gatherering
- Eye Tracking
- ExPresS XR Rig
- Interaction
- Base Button
- Button Quiz
- Collision Hand Rumbler
- Collision Sound Emitter
- Exit Game Interactable (Script Deprecated)
- Interactables
- Haptic Impulse Trigger
- Socket Interactors
- Inverse Kinematics
- Localization
- Minigames
- Coin Scale
- Coin Throw
- Sword Cleaning
- Misc
- Movement
- Presentation
- UI