2using System.Collections.Generic;
10using UnityEngine.EventSystems;
12using PixoVR.Apex.XAPI;
31 [SerializeField]
private string sfxClick;
88 foreach (var question
in quiz.Questions)
90 question.ClearAnswers();
103 _confirmButton.interactable =
false;
136 EventSystem.current.SetSelectedGameObject(
null);
172 EventSystem.current.SetSelectedGameObject(
null);
179 private void SendApexEvents(QuestionInformation questionInformation)
183 var eventData =
new Dictionary<string, string>
185 {
"Time", $
"{DateTime.UtcNow}" },
186 {
"Question", $
"{questionInformation.Question}" },
187 {
"Correct Answer", $
"{questionInformation.GetCorrectAnswer()}" },
188 {
"Given Answer", $
"{questionInformation.GetSelectedAnswer()}" },
189 {
"Earned Score", $
"{questionInformation.GetEarnedScoring()}" },
190 {
"Max Score", $
"{questionInformation.Scoring}" }
193 ApexSystem.SendSimpleSessionEvent(
"Custom event",
"",
194 new Extension(eventData));
202 private void OnToggleSelected(
string selectedAnswer,
bool isCorrect,
int optionID)
207 _confirmButton.interactable =
true;
231 _confirmButton.interactable =
false;
241 if (VO_Description !=
string.Empty)
259 List<int> correctAnswers;
280 if (i < optionsAnswers.Count)
293 foreach (var answer
in correctAnswers)
301 private void PlayFeedbackVoiceOver(
string idVo,
bool isLastQuestion =
true,
bool isVoMustFinished =
false)
303 if (isVoMustFinished)
306 _canvasGroup.interactable =
false;
307 _confirmButton.interactable =
false;
310 _audioService.RepeatableAudioStopped +=
Hide;
314 _audioService.RepeatableAudioStopped += () =>
317 _canvasGroup.interactable =
true;
343 var scenarioState = StatesService.GetState<ScenarioState>();
355 if (questionInformation.VO_ID_RightAnswer_NotBroken ==
string.Empty
356 || scenarioState.IsEvaluation)
return;
364 if (questionInformation.VO_ID_Incorrect_NotBroken ==
string.Empty
365 || scenarioState.IsEvaluation)
return;
379 if ((questionInformation.VO_ID_RightAnswerBroken ==
string.Empty &&
_brokenID == 0)
381 questionInformation.VO_ID_RightAnswersAdditionalBroken[
_brokenID - 1] ==
string.Empty)
382 || scenarioState.IsEvaluation)
393 ? questionInformation.VO_ID_RightAnswerBroken
394 : questionInformation.VO_ID_RightAnswersAdditionalBroken[
_brokenID - 1],
408 if ((questionInformation.VO_ID_Incorrect_Broken ==
string.Empty &&
_brokenID == 0) ||
409 (
_brokenID > 0 && questionInformation.VO_ID_Incorrect_AdditionalBroken[
_brokenID - 1] ==
411 || scenarioState.IsEvaluation)
return;
414 ? questionInformation.VO_ID_Incorrect_Broken
415 : questionInformation.VO_ID_Incorrect_AdditionalBroken[
_brokenID - 1]);
424 if (questionInformation.VO_ID_RightAnswer_NotBroken ==
string.Empty
425 || scenarioState.IsEvaluation)
return;
434 if (questionInformation.VO_ID_Incorrect_NotBroken ==
string.Empty
435 || scenarioState.IsEvaluation)
return;
452 _audioService.RepeatableAudioStopped -=
Hide;
453 _confirmButton.interactable =
false;
463 _confirmButton.interactable =
false;
476 public override void Interactive(
bool isInteractive)
480 _canvasGroup.alpha = isInteractive ? 1 : 0;
481 _canvasGroup.blocksRaycasts = isInteractive;
482 _canvasGroup.interactable = isInteractive;
488 if (isInteractive && !isAlreadySubscribe)
495 else if (!isInteractive)
514 go.SetActive(isActive);
524 firstQuestion.SetCorrectAnswer(additionalValues[0]);
525 firstQuestion.SetSelectedAnswer(additionalValues[1]);
Main logic for playing fxs and voice overs.
int PlayFX(string fxName)
Play FX by fx name.
void StopAllVoiceOvers()
Stop all voice overs.
void PlayRepeatable(string voiceOverName)
Play voice repeating it at a certain time intervals.
Intentionally made partial, in case you want to extend it easily.
Unity components communication service.
s Base class for interactable objects with which the step manager interacts. It also stores a set of ...
virtual void RepairElement()
Remove from the broken state object.
virtual void SetInspected()
Quiz GetQuizItem(string quizID="")
List< Quiz > ListOfQuizzes
void UnsubscribeOnToggles()
NearWaypoint _nearWaypoint
[SerializeField]
TMP_Text singleText
[SerializeField]
void PlayFeedbackVoiceOver(string idVo, bool isLastQuestion=true, bool isVoMustFinished=false)
override void SetParametersForItem(string quizId, string[] additionalValues)
void SendApexEvents(QuestionInformation questionInformation)
QuizData _quizData
[SerializeField]
void OnToggleSelected(string selectedAnswer, bool isCorrect, int optionID)
Button _confirmButton
[SerializeField]
string sfxFixBrokenItem
[SerializeField]
int _selectedAnswerOptionID
bool _isSelectedCorrectAnswer
bool _isShouldWaitForEndingVO
void SetAnswersOptions(QuestionInformation questionInformation)
void ClearAnswersHistory()
TMP_Text _questionText
[SerializeField]
override void OpenInspectionMenu(string quizID)
Enable inpection menu UI.
AudioService _audioService
InteractableClass _itemInQuestion
void SetQuestionInformation()
void SetQuestionText(string questionText)
void RepairObject(ItemsEnum itemId)
void SetInspectedMark(ItemsEnum itemId)
void OnConfirmButtonClick()
GameObject[] _additionalItemsToEnable
[SerializeField]
AnswerOption[] _answerOptions
[SerializeField]
override void Interactive(bool isInteractive)
ApexSessionState _apexSessionState
string sfxCorrectAnswer
[SerializeField]
bool _objectsShouldBeRepaired
bool _useNearWaypoint
[SerializeField]
ItemsEnum _itemIdInQuestion
bool _correectAnswerShouldBeCleanedForNone
[SerializeField]
int currentQuestionIndex
[SerializeField]
void EnableAdditionalItems(bool isActive)
string sfxClick
[SerializeField]
List< VisibilityControlPoint > _visibilityControlPoints
[SerializeField]
TMP_Text _confirmText
[SerializeField]
void SubscribeOnToggles()
string sfxIncorrectAnswer
[SerializeField]
List< QuestionInformation > Questions
Logic for saving and unloading states during project execution.
Main system for working with steps lists.
InteractableClass GetGameObjectByID(ItemsEnum itemId)
Get scene object by item id.
ItemsEnum
Represents a list of ID for interactable objects.