| | 1 | | using UnityEngine; |
| | 2 | | using UnityEngine.EventSystems; |
| | 3 | |
|
| | 4 | | namespace DCL.Tutorial |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Class that represents the onboarding tutorial step related to how to navigate through the Start Menu. |
| | 8 | | /// </summary> |
| | 9 | | public class TutorialStep_Tooltip_StartMenu : TutorialStep_Tooltip |
| | 10 | | { |
| | 11 | | internal const int TEACHER_CANVAS_SORT_ORDER_START = 4; |
| | 12 | | internal const string TUTORIAL_COMPLETED_STEP = "TutorialStep_TutorialCompleted"; |
| | 13 | | internal const string TOP_MENU_STEP = "TutorialStep_StartMenuTooltip_TopMenu"; |
| | 14 | | internal const string PLACES_AND_EVENTS_STEP = "TutorialStep_StartMenuTooltip_PlacesAndEventsSection"; |
| | 15 | | internal const string BACKPACK_STEP = "TutorialStep_StartMenuTooltip_BackpackSection"; |
| | 16 | | internal const string MAP_STEP = "TutorialStep_StartMenuTooltip_MapSection"; |
| | 17 | | internal const string BUILDER_STEP = "TutorialStep_StartMenuTooltip_BuilderSection"; |
| | 18 | | internal const string QUEST_STEP = "TutorialStep_StartMenuTooltip_QuestSection"; |
| | 19 | | internal const string SETTINGS_STEP = "TutorialStep_StartMenuTooltip_SettingsSection"; |
| | 20 | | internal int defaultTeacherCanvasSortOrder; |
| | 21 | |
|
| | 22 | | public override void OnStepStart() |
| | 23 | | { |
| 0 | 24 | | base.OnStepStart(); |
| | 25 | |
|
| 0 | 26 | | DataStore.i.exploreV2.isOpen.OnChange += ExploreV2IsOpenChanged; |
| 0 | 27 | | DataStore.i.exploreV2.placesAndEventsVisible.OnChange += PlacesAndEventsVisibleChanged; |
| 0 | 28 | | DataStore.i.HUDs.questsPanelVisible.OnChange += QuestsPanelVisibleChanged; |
| 0 | 29 | | DataStore.i.HUDs.avatarEditorVisible.OnChange += AvatarEditorVisibleChanged; |
| 0 | 30 | | DataStore.i.HUDs.navmapVisible.OnChange += NavMapVisibleChanged; |
| 0 | 31 | | DataStore.i.HUDs.builderProjectsPanelVisible.OnChange += BuilderProjectsPanelVisibleChanged; |
| 0 | 32 | | DataStore.i.settings.settingsPanelVisible.OnChange += SettingsPanelVisibleChanged; |
| | 33 | |
|
| 0 | 34 | | if (tutorialController.configuration.teacherCanvas != null) |
| 0 | 35 | | defaultTeacherCanvasSortOrder = tutorialController.configuration.teacherCanvas.sortingOrder; |
| | 36 | |
|
| 0 | 37 | | tutorialController.SetTeacherCanvasSortingOrder(TEACHER_CANVAS_SORT_ORDER_START); |
| 0 | 38 | | isRelatedFeatureActived = true; |
| 0 | 39 | | } |
| | 40 | |
|
| | 41 | | public override void OnStepFinished() |
| | 42 | | { |
| 0 | 43 | | base.OnStepFinished(); |
| | 44 | |
|
| 0 | 45 | | tutorialController.SetTeacherCanvasSortingOrder(defaultTeacherCanvasSortOrder); |
| | 46 | |
|
| 0 | 47 | | DataStore.i.exploreV2.isOpen.OnChange -= ExploreV2IsOpenChanged; |
| 0 | 48 | | DataStore.i.exploreV2.placesAndEventsVisible.OnChange -= PlacesAndEventsVisibleChanged; |
| 0 | 49 | | DataStore.i.HUDs.questsPanelVisible.OnChange -= QuestsPanelVisibleChanged; |
| 0 | 50 | | DataStore.i.HUDs.avatarEditorVisible.OnChange -= AvatarEditorVisibleChanged; |
| 0 | 51 | | DataStore.i.HUDs.navmapVisible.OnChange -= NavMapVisibleChanged; |
| 0 | 52 | | DataStore.i.HUDs.builderProjectsPanelVisible.OnChange -= BuilderProjectsPanelVisibleChanged; |
| 0 | 53 | | DataStore.i.settings.settingsPanelVisible.OnChange -= SettingsPanelVisibleChanged; |
| 0 | 54 | | } |
| | 55 | |
|
| | 56 | | public override void OnPointerDown(PointerEventData eventData) |
| | 57 | | { |
| 0 | 58 | | base.OnPointerDown(eventData); |
| | 59 | |
|
| 0 | 60 | | tutorialController.PlayTeacherAnimation(TutorialTeacher.TeacherAnimation.QuickGoodbye); |
| 0 | 61 | | } |
| | 62 | |
|
| | 63 | | protected override void SetTooltipPosition() |
| | 64 | | { |
| 0 | 65 | | base.SetTooltipPosition(); |
| | 66 | |
|
| 0 | 67 | | Transform startMenuTooltipTransform = null; |
| | 68 | |
|
| 0 | 69 | | switch (gameObject.name) |
| | 70 | | { |
| | 71 | | case TOP_MENU_STEP: |
| 0 | 72 | | startMenuTooltipTransform = DataStore.i.exploreV2.topMenuTooltipReference.Get(); |
| 0 | 73 | | break; |
| | 74 | | case PLACES_AND_EVENTS_STEP: |
| 0 | 75 | | startMenuTooltipTransform = DataStore.i.exploreV2.placesAndEventsTooltipReference.Get(); |
| 0 | 76 | | break; |
| | 77 | | case BACKPACK_STEP: |
| 0 | 78 | | startMenuTooltipTransform = DataStore.i.exploreV2.backpackTooltipReference.Get(); |
| 0 | 79 | | break; |
| | 80 | | case MAP_STEP: |
| 0 | 81 | | startMenuTooltipTransform = DataStore.i.exploreV2.mapTooltipReference.Get(); |
| 0 | 82 | | break; |
| | 83 | | case BUILDER_STEP: |
| 0 | 84 | | startMenuTooltipTransform = DataStore.i.exploreV2.builderTooltipReference.Get(); |
| 0 | 85 | | break; |
| | 86 | | case QUEST_STEP: |
| 0 | 87 | | startMenuTooltipTransform = DataStore.i.exploreV2.questTooltipReference.Get(); |
| 0 | 88 | | break; |
| | 89 | | case SETTINGS_STEP: |
| 0 | 90 | | startMenuTooltipTransform = DataStore.i.exploreV2.settingsTooltipReference.Get(); |
| | 91 | | break; |
| | 92 | | } |
| | 93 | |
|
| 0 | 94 | | if (startMenuTooltipTransform != null) |
| 0 | 95 | | tooltipTransform.position = startMenuTooltipTransform.position - (Vector3.down * -30f); |
| 0 | 96 | | } |
| | 97 | |
|
| | 98 | | internal void ExploreV2IsOpenChanged(bool current, bool previous) |
| | 99 | | { |
| 0 | 100 | | if (current) |
| 0 | 101 | | return; |
| | 102 | |
|
| 0 | 103 | | tutorialController.GoToSpecificStep(TUTORIAL_COMPLETED_STEP); |
| 0 | 104 | | } |
| | 105 | |
|
| | 106 | | internal void PlacesAndEventsVisibleChanged(bool current, bool previous) |
| | 107 | | { |
| 0 | 108 | | if (!current) |
| 0 | 109 | | return; |
| | 110 | |
|
| 0 | 111 | | tutorialController.GoToSpecificStep(PLACES_AND_EVENTS_STEP); |
| 0 | 112 | | } |
| | 113 | |
|
| | 114 | | internal void AvatarEditorVisibleChanged(bool current, bool previous) |
| | 115 | | { |
| 0 | 116 | | if (!current) |
| 0 | 117 | | return; |
| | 118 | |
|
| 0 | 119 | | tutorialController.GoToSpecificStep(BACKPACK_STEP); |
| 0 | 120 | | } |
| | 121 | |
|
| | 122 | | internal void NavMapVisibleChanged(bool current, bool previous) |
| | 123 | | { |
| 0 | 124 | | if (!current) |
| 0 | 125 | | return; |
| | 126 | |
|
| 0 | 127 | | tutorialController.GoToSpecificStep(MAP_STEP); |
| 0 | 128 | | } |
| | 129 | |
|
| | 130 | | internal void BuilderProjectsPanelVisibleChanged(bool current, bool previous) |
| | 131 | | { |
| 0 | 132 | | if (!current) |
| 0 | 133 | | return; |
| | 134 | |
|
| 0 | 135 | | tutorialController.GoToSpecificStep(BUILDER_STEP); |
| 0 | 136 | | } |
| | 137 | |
|
| | 138 | | internal void QuestsPanelVisibleChanged(bool current, bool previous) |
| | 139 | | { |
| 0 | 140 | | if (!current) |
| 0 | 141 | | return; |
| | 142 | |
|
| 0 | 143 | | tutorialController.GoToSpecificStep(QUEST_STEP); |
| 0 | 144 | | } |
| | 145 | |
|
| | 146 | | internal void SettingsPanelVisibleChanged(bool current, bool previous) |
| | 147 | | { |
| 0 | 148 | | if (!current) |
| 0 | 149 | | return; |
| | 150 | |
|
| 0 | 151 | | tutorialController.GoToSpecificStep(SETTINGS_STEP); |
| 0 | 152 | | } |
| | 153 | | } |
| | 154 | | } |