< Summary

Class:PlacesAndEventsSectionComponentView
Assembly:ExploreV2
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/ExploreV2/Scripts/Sections/PlacesAndEventsSection/PlacesAndEventsSectionComponentView.cs
Covered lines:14
Uncovered lines:2
Coverable lines:16
Total lines:51
Line coverage:87.5% (14 of 16)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Start()0%2.062075%
OnDestroy()0%110100%
CreateSubSectionSelectorMappings()0%330100%
RemoveSectionSelectorMappings()0%330100%
ShowDefaultSubSection()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/ExploreV2/Scripts/Sections/PlacesAndEventsSection/PlacesAndEventsSectionComponentView.cs

#LineLine coverage
 1using UnityEngine;
 2
 3public interface IPlacesAndEventsSectionComponentView
 4{
 5    /// <summary>
 6    /// Events sub-section component.
 7    /// </summary>
 8    IEventsSubSectionComponentView currentEventsSubSectionComponentView { get; }
 9}
 10
 11public class PlacesAndEventsSectionComponentView : MonoBehaviour, IPlacesAndEventsSectionComponentView
 12{
 13    [Header("Top Menu")]
 14    [SerializeField] internal SectionSelectorComponentView subSectionSelector;
 15
 16    [Header("Sections")]
 17    [SerializeField] internal PlacesSubSectionComponentView placesSubSection;
 18    [SerializeField] internal EventsSubSectionComponentView eventsSubSection;
 19
 020    public IEventsSubSectionComponentView currentEventsSubSectionComponentView => eventsSubSection;
 21
 22    private void Start()
 23    {
 824        if (subSectionSelector.isFullyInitialized)
 025            CreateSubSectionSelectorMappings();
 26        else
 827            subSectionSelector.OnFullyInitialized += CreateSubSectionSelectorMappings;
 828    }
 29
 30    private void OnDestroy()
 31    {
 2032        subSectionSelector.OnFullyInitialized -= CreateSubSectionSelectorMappings;
 2033        RemoveSectionSelectorMappings();
 2034    }
 35
 36    internal void CreateSubSectionSelectorMappings()
 37    {
 2138        subSectionSelector.GetSection(0)?.onSelect.AddListener((isOn) => placesSubSection.gameObject.SetActive(isOn));
 1339        subSectionSelector.GetSection(1)?.onSelect.AddListener((isOn) => eventsSubSection.gameObject.SetActive(isOn));
 40
 1241        ShowDefaultSubSection();
 1242    }
 43
 44    internal void RemoveSectionSelectorMappings()
 45    {
 2246        subSectionSelector.GetSection(0)?.onSelect.RemoveAllListeners();
 2247        subSectionSelector.GetSection(1)?.onSelect.RemoveAllListeners();
 1548    }
 49
 2650    internal void ShowDefaultSubSection() { placesSubSection.gameObject.SetActive(true); }
 51}