< Summary

Class:DCL.Tutorial.TutorialStep_Tooltip_StartMenu
Assembly:Onboarding
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/Steps/Initial/TutorialStep_Tooltip_StartMenu.cs
Covered lines:0
Uncovered lines:73
Coverable lines:73
Total lines:154
Line coverage:0% (0 of 73)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
OnStepStart()0%6200%
OnStepFinished()0%2100%
OnPointerDown(...)0%2100%
SetTooltipPosition()0%3801900%
ExploreV2IsOpenChanged(...)0%6200%
PlacesAndEventsVisibleChanged(...)0%6200%
AvatarEditorVisibleChanged(...)0%6200%
NavMapVisibleChanged(...)0%6200%
BuilderProjectsPanelVisibleChanged(...)0%6200%
QuestsPanelVisibleChanged(...)0%6200%
SettingsPanelVisibleChanged(...)0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/Steps/Initial/TutorialStep_Tooltip_StartMenu.cs

#LineLine coverage
 1using UnityEngine;
 2using UnityEngine.EventSystems;
 3
 4namespace 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        {
 024            base.OnStepStart();
 25
 026            DataStore.i.exploreV2.isOpen.OnChange += ExploreV2IsOpenChanged;
 027            DataStore.i.exploreV2.placesAndEventsVisible.OnChange += PlacesAndEventsVisibleChanged;
 028            DataStore.i.HUDs.questsPanelVisible.OnChange += QuestsPanelVisibleChanged;
 029            DataStore.i.HUDs.avatarEditorVisible.OnChange += AvatarEditorVisibleChanged;
 030            DataStore.i.HUDs.navmapVisible.OnChange += NavMapVisibleChanged;
 031            DataStore.i.HUDs.builderProjectsPanelVisible.OnChange += BuilderProjectsPanelVisibleChanged;
 032            DataStore.i.settings.settingsPanelVisible.OnChange += SettingsPanelVisibleChanged;
 33
 034            if (tutorialController.configuration.teacherCanvas != null)
 035                defaultTeacherCanvasSortOrder = tutorialController.configuration.teacherCanvas.sortingOrder;
 36
 037            tutorialController.SetTeacherCanvasSortingOrder(TEACHER_CANVAS_SORT_ORDER_START);
 038            isRelatedFeatureActived = true;
 039        }
 40
 41        public override void OnStepFinished()
 42        {
 043            base.OnStepFinished();
 44
 045            tutorialController.SetTeacherCanvasSortingOrder(defaultTeacherCanvasSortOrder);
 46
 047            DataStore.i.exploreV2.isOpen.OnChange -= ExploreV2IsOpenChanged;
 048            DataStore.i.exploreV2.placesAndEventsVisible.OnChange -= PlacesAndEventsVisibleChanged;
 049            DataStore.i.HUDs.questsPanelVisible.OnChange -= QuestsPanelVisibleChanged;
 050            DataStore.i.HUDs.avatarEditorVisible.OnChange -= AvatarEditorVisibleChanged;
 051            DataStore.i.HUDs.navmapVisible.OnChange -= NavMapVisibleChanged;
 052            DataStore.i.HUDs.builderProjectsPanelVisible.OnChange -= BuilderProjectsPanelVisibleChanged;
 053            DataStore.i.settings.settingsPanelVisible.OnChange -= SettingsPanelVisibleChanged;
 054        }
 55
 56        public override void OnPointerDown(PointerEventData eventData)
 57        {
 058            base.OnPointerDown(eventData);
 59
 060            tutorialController.PlayTeacherAnimation(TutorialTeacher.TeacherAnimation.QuickGoodbye);
 061        }
 62
 63        protected override void SetTooltipPosition()
 64        {
 065            base.SetTooltipPosition();
 66
 067            Transform startMenuTooltipTransform = null;
 68
 069            switch (gameObject.name)
 70            {
 71                case TOP_MENU_STEP:
 072                    startMenuTooltipTransform = DataStore.i.exploreV2.topMenuTooltipReference.Get();
 073                    break;
 74                case PLACES_AND_EVENTS_STEP:
 075                    startMenuTooltipTransform = DataStore.i.exploreV2.placesAndEventsTooltipReference.Get();
 076                    break;
 77                case BACKPACK_STEP:
 078                    startMenuTooltipTransform = DataStore.i.exploreV2.backpackTooltipReference.Get();
 079                    break;
 80                case MAP_STEP:
 081                    startMenuTooltipTransform = DataStore.i.exploreV2.mapTooltipReference.Get();
 082                    break;
 83                case BUILDER_STEP:
 084                    startMenuTooltipTransform = DataStore.i.exploreV2.builderTooltipReference.Get();
 085                    break;
 86                case QUEST_STEP:
 087                    startMenuTooltipTransform = DataStore.i.exploreV2.questTooltipReference.Get();
 088                    break;
 89                case SETTINGS_STEP:
 090                    startMenuTooltipTransform = DataStore.i.exploreV2.settingsTooltipReference.Get();
 91                    break;
 92            }
 93
 094            if (startMenuTooltipTransform != null)
 095                tooltipTransform.position = startMenuTooltipTransform.position - (Vector3.down * -30f);
 096        }
 97
 98        internal void ExploreV2IsOpenChanged(bool current, bool previous)
 99        {
 0100            if (current)
 0101                return;
 102
 0103            tutorialController.GoToSpecificStep(TUTORIAL_COMPLETED_STEP);
 0104        }
 105
 106        internal void PlacesAndEventsVisibleChanged(bool current, bool previous)
 107        {
 0108            if (!current)
 0109                return;
 110
 0111            tutorialController.GoToSpecificStep(PLACES_AND_EVENTS_STEP);
 0112        }
 113
 114        internal void AvatarEditorVisibleChanged(bool current, bool previous)
 115        {
 0116            if (!current)
 0117                return;
 118
 0119            tutorialController.GoToSpecificStep(BACKPACK_STEP);
 0120        }
 121
 122        internal void NavMapVisibleChanged(bool current, bool previous)
 123        {
 0124            if (!current)
 0125                return;
 126
 0127            tutorialController.GoToSpecificStep(MAP_STEP);
 0128        }
 129
 130        internal void BuilderProjectsPanelVisibleChanged(bool current, bool previous)
 131        {
 0132            if (!current)
 0133                return;
 134
 0135            tutorialController.GoToSpecificStep(BUILDER_STEP);
 0136        }
 137
 138        internal void QuestsPanelVisibleChanged(bool current, bool previous)
 139        {
 0140            if (!current)
 0141                return;
 142
 0143            tutorialController.GoToSpecificStep(QUEST_STEP);
 0144        }
 145
 146        internal void SettingsPanelVisibleChanged(bool current, bool previous)
 147        {
 0148            if (!current)
 0149                return;
 150
 0151            tutorialController.GoToSpecificStep(SETTINGS_STEP);
 0152        }
 153    }
 154}