< Summary

Class:SectionPlacesView
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/Views/MenuSections/SectionPlacesView.cs
Covered lines:29
Uncovered lines:6
Coverable lines:35
Total lines:81
Line coverage:82.8% (29 of 35)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SetParent(...)0%2100%
SetActive(...)0%2100%
ResetScrollRect()0%110100%
SetEmpty()0%110100%
SetLoading()0%110100%
SetNoSearchResult()0%110100%
SetFilled()0%110100%
GetCardsContainer()0%2100%
Dispose()0%220100%
Awake()0%110100%
OnDestroy()0%110100%
OnScrollValueChanged(...)0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/Views/MenuSections/SectionPlacesView.cs

#LineLine coverage
 1using System;
 2using DCL.Helpers;
 3using UnityEngine;
 4using UnityEngine.UI;
 5
 6internal class SectionPlacesView : MonoBehaviour, IDisposable
 7{
 8    public event Action OnScrollRectValueChanged;
 9
 10    [SerializeField] public Transform scenesCardContainer;
 11    [SerializeField] public ScrollRect scrollRect;
 12    [SerializeField] internal GameObject contentContainer;
 13    [SerializeField] internal GameObject emptyContainer;
 14    [SerializeField] internal GameObject noSearchResultContainer;
 15    [SerializeField] internal GameObject loadingAnimationContainer;
 16
 17    private bool isDestroyed = false;
 18
 19    public void SetParent(Transform parent)
 20    {
 021        transform.SetParent(parent);
 022        transform.ResetLocalTRS();
 023    }
 24
 025    public void SetActive(bool active) { gameObject.SetActive(active); }
 26
 827    public void ResetScrollRect() { scrollRect.verticalNormalizedPosition = 1; }
 28
 29    public void SetEmpty()
 30    {
 231        contentContainer.SetActive(false);
 232        emptyContainer.SetActive(true);
 233        noSearchResultContainer.SetActive(false);
 234        loadingAnimationContainer.SetActive(false);
 235    }
 36
 37    public void SetLoading()
 38    {
 239        contentContainer.SetActive(false);
 240        emptyContainer.SetActive(false);
 241        noSearchResultContainer.SetActive(false);
 242        loadingAnimationContainer.SetActive(true);
 243    }
 44
 45    public void SetNoSearchResult()
 46    {
 147        contentContainer.SetActive(false);
 148        emptyContainer.SetActive(false);
 149        noSearchResultContainer.SetActive(true);
 150        loadingAnimationContainer.SetActive(false);
 151    }
 52
 53    public void SetFilled()
 54    {
 455        contentContainer.SetActive(true);
 456        emptyContainer.SetActive(false);
 457        noSearchResultContainer.SetActive(false);
 458        loadingAnimationContainer.SetActive(false);
 459        ResetScrollRect();
 460    }
 61
 062    public Transform GetCardsContainer() { return scenesCardContainer; }
 63
 64    public void Dispose()
 65    {
 266        if (!isDestroyed)
 67        {
 268            Destroy(gameObject);
 69        }
 270    }
 71
 1872    private void Awake() { scrollRect.onValueChanged.AddListener(OnScrollValueChanged); }
 73
 74    private void OnDestroy()
 75    {
 976        isDestroyed = true;
 977        scrollRect.onValueChanged.RemoveListener(OnScrollValueChanged);
 978    }
 79
 080    private void OnScrollValueChanged(Vector2 value) { OnScrollRectValueChanged?.Invoke(); }
 81}