| | 1 | | using System.Collections; |
| | 2 | | using UnityEngine; |
| | 3 | | using UnityEngine.UI; |
| | 4 | |
|
| | 5 | | namespace DCL.Tutorial |
| | 6 | | { |
| | 7 | | /// <summary> |
| | 8 | | /// Class that represents the onboarding tutorial step related to the very basic controls. |
| | 9 | | /// </summary> |
| | 10 | | public class TutorialStep_BasicControls : TutorialStep |
| | 11 | | { |
| | 12 | | private const int TEACHER_CANVAS_SORT_ORDER_START = 4; |
| | 13 | |
|
| | 14 | | [SerializeField] AudioEvent audioEventSuccess; |
| | 15 | | [SerializeField] Button okButton; |
| | 16 | |
|
| | 17 | | internal bool stepIsFinished = false; |
| | 18 | | private int defaultTeacherCanvasSortOrder; |
| | 19 | |
|
| | 20 | | public override void OnStepStart() |
| | 21 | | { |
| 1 | 22 | | base.OnStepStart(); |
| | 23 | |
|
| 1 | 24 | | CommonScriptableObjects.featureKeyTriggersBlocked.Set(true); |
| | 25 | |
|
| 1 | 26 | | okButton.onClick.AddListener(OnOkButtonClick); |
| | 27 | |
|
| 1 | 28 | | if (tutorialController.configuration.teacherCanvas != null) |
| 1 | 29 | | defaultTeacherCanvasSortOrder = tutorialController.configuration.teacherCanvas.sortingOrder; |
| | 30 | |
|
| 1 | 31 | | tutorialController.SetTeacherCanvasSortingOrder(TEACHER_CANVAS_SORT_ORDER_START); |
| | 32 | |
|
| 1 | 33 | | tutorialController.hudController?.taskbarHud?.SetVisibility(false); |
| 0 | 34 | | } |
| | 35 | |
|
| | 36 | | public override IEnumerator OnStepExecute() |
| | 37 | | { |
| 4 | 38 | | yield return new WaitUntil(() => stepIsFinished); |
| 1 | 39 | | audioEventSuccess.Play(true); |
| 1 | 40 | | } |
| | 41 | |
|
| | 42 | | public override void OnStepFinished() |
| | 43 | | { |
| 1 | 44 | | base.OnStepFinished(); |
| 1 | 45 | | tutorialController.SetTeacherCanvasSortingOrder(defaultTeacherCanvasSortOrder); |
| 1 | 46 | | tutorialController.hudController?.taskbarHud?.SetVisibility(true); |
| 1 | 47 | | CommonScriptableObjects.featureKeyTriggersBlocked.Set(false); |
| 1 | 48 | | } |
| | 49 | |
|
| 0 | 50 | | internal void OnOkButtonClick() { stepIsFinished = true; } |
| | 51 | | } |
| | 52 | | } |