< Summary

Class:DCL.NavMapChunksLayersView
Assembly:Navmap
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/NavMap/NavMapChunksLayersView.cs
Covered lines:8
Uncovered lines:11
Coverable lines:19
Total lines:64
Line coverage:42.1% (8 of 19)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:5
Method coverage:40% (2 of 5)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Start()0%110100%
OnDestroy()0%110100%
Hide()0%2100%
OnHyperLinkClicked()0%6200%
SetState(...)0%2100%

File(s)

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

#LineLine coverage
 1using System;
 2using UIComponents.Scripts.Components.Text;
 3using UnityEngine;
 4using UnityEngine.UI;
 5
 6namespace DCL
 7{
 8    public class NavMapChunksLayersView : MonoBehaviour
 9    {
 10        private const int SATELLITE_SECTION = 0;
 11        private const int PARCELS_SECTION = 1;
 12
 13        [SerializeField] private SectionSelectorComponentView atlasLayerSectionSelector;
 14
 15        [Space]
 16        [SerializeField] private TMPTextHyperLink tmpTextHyperLink;
 17
 18        private Image satelliteLayerBackground;
 19        private Image parcelsLayerBackground;
 20
 21        public event Action ParcelsButtonClicked;
 22        public event Action SatelliteButtonClicked;
 23        public event Action HyperLinkClicked;
 24
 25        private void Start()
 26        {
 127            atlasLayerSectionSelector.GetSection(SATELLITE_SECTION)
 28                                     .onSelect.AddListener(isActive =>
 29                                      {
 030                                          if (isActive)
 031                                              SatelliteButtonClicked?.Invoke();
 032                                      });
 33
 134            atlasLayerSectionSelector.GetSection(PARCELS_SECTION)
 35                                     .onSelect.AddListener(isActive =>
 36                                      {
 037                                          if (isActive)
 038                                              ParcelsButtonClicked?.Invoke();
 039                                      });
 40
 141            tmpTextHyperLink.HyperLinkClicked += OnHyperLinkClicked;
 142        }
 43
 44        private void OnDestroy()
 45        {
 146            atlasLayerSectionSelector.GetSection(SATELLITE_SECTION).onSelect.RemoveAllListeners();
 147            atlasLayerSectionSelector.GetSection(PARCELS_SECTION).onSelect.RemoveAllListeners();
 48
 149            tmpTextHyperLink.HyperLinkClicked -= OnHyperLinkClicked;
 150        }
 51
 52        public void Hide()
 53        {
 054            tmpTextHyperLink.gameObject.SetActive(false);
 055            atlasLayerSectionSelector.gameObject.SetActive(false);
 056        }
 57
 58        private void OnHyperLinkClicked() =>
 059            HyperLinkClicked?.Invoke();
 60
 61        public void SetState(bool satelliteViewActive) =>
 062            tmpTextHyperLink.gameObject.SetActive(satelliteViewActive);
 63    }
 64}