< Summary

Class:DCL.NavMapLoadingLogo
Assembly:Navmap
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/NavMap/NavMapLoadingLogo.cs
Covered lines:8
Uncovered lines:10
Coverable lines:18
Total lines:52
Line coverage:44.4% (8 of 18)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:6
Method coverage:33.3% (2 of 6)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
OnDestroy()0%110100%
OnExploreUiVisibilityChange(...)0%12300%
OnOpeningNavMap(...)0%6200%
OnNavMapIsRenderedChanged(...)0%6200%
SetImagesVisibility(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/NavMap/NavMapLoadingLogo.cs

#LineLine coverage
 1using UnityEngine;
 2using UnityEngine.UI;
 3
 4namespace DCL
 5{
 6    /// <summary>
 7    /// Hide white images when switching to NavMap.
 8    /// FIX issue #2071 <see cref="https://github.com/decentraland/unity-renderer/issues/2071"/>
 9    /// </summary>
 10    public class NavMapLoadingLogo : MonoBehaviour
 11    {
 12        [SerializeField] private Image sectionsContent;
 13        [SerializeField] private Image radialGradient;
 14
 15        private void Awake()
 16        {
 2917            DataStore.i.HUDs.navmapVisible.OnChange += OnOpeningNavMap;
 2918            DataStore.i.HUDs.navmapIsRendered.OnChange += OnNavMapIsRenderedChanged;
 2919            DataStore.i.exploreV2.isOpen.OnChange += OnExploreUiVisibilityChange;
 2920        }
 21
 22        private void OnDestroy()
 23        {
 2924            DataStore.i.HUDs.navmapVisible.OnChange -= OnOpeningNavMap;
 2925            DataStore.i.exploreV2.isOpen.OnChange -= OnExploreUiVisibilityChange;
 26
 2927            DataStore.i.HUDs.navmapIsRendered.OnChange -= OnNavMapIsRenderedChanged;
 2928        }
 29
 30        private void OnExploreUiVisibilityChange(bool isOpen, bool _)
 31        {
 032            if (!isOpen && !sectionsContent.enabled) { SetImagesVisibility(visible: true); }
 033        }
 34
 35        private void OnOpeningNavMap(bool isShown, bool _)
 36        {
 037            if (isShown) { SetImagesVisibility(visible: false); }
 038        }
 39
 40        private void OnNavMapIsRenderedChanged(bool @new, bool previous)
 41        {
 042            if (@new)
 043                SetImagesVisibility(true);
 044        }
 45
 46        private void SetImagesVisibility(bool visible)
 47        {
 048            sectionsContent.enabled = visible;
 049            radialGradient.enabled = visible;
 050        }
 51    }
 52}