< Summary

Class:SectionLandView
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Scripts/Views/MenuSections/SectionLandView.cs
Covered lines:29
Uncovered lines:4
Coverable lines:33
Total lines:78
Line coverage:87.8% (29 of 33)
Covered branches:0
Total branches:0

Metrics

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

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Scripts/Views/MenuSections/SectionLandView.cs

#LineLine coverage
 1using System;
 2using DCL.Helpers;
 3using UnityEngine;
 4using UnityEngine.UI;
 5
 6internal class SectionLandView : MonoBehaviour, IDisposable
 7{
 8    public event Action OnOpenMarketplaceRequested;
 9
 10    [SerializeField] internal LandElementView landElementView;
 11    [SerializeField] private ScrollRect scrollRect;
 12    [SerializeField] internal GameObject contentContainer;
 13    [SerializeField] internal GameObject emptyContainer;
 14    [SerializeField] internal GameObject loadingAnimationContainer;
 15    [SerializeField] internal GameObject noSearchResultContainer;
 16    [SerializeField] internal Button buttonNoLandCTA;
 17
 18    private bool isDestroyed = false;
 19
 1620    private void Awake() { buttonNoLandCTA.onClick.AddListener(() => OnOpenMarketplaceRequested?.Invoke()); }
 21
 1622    private void OnDestroy() { isDestroyed = true; }
 23
 24    public void SetParent(Transform parent)
 25    {
 026        transform.SetParent(parent);
 027        transform.ResetLocalTRS();
 028    }
 29
 630    public void SetActive(bool active) { gameObject.SetActive(active); }
 31
 1032    public void ResetScrollRect() { scrollRect.verticalNormalizedPosition = 1; }
 33
 1234    public Transform GetLandElementsContainer() { return landElementView.GetParent(); }
 35
 036    public LandElementView GetLandElementeBaseView() { return landElementView; }
 37
 38    public void SetEmpty()
 39    {
 340        contentContainer.SetActive(false);
 341        emptyContainer.SetActive(true);
 342        noSearchResultContainer.SetActive(false);
 343        loadingAnimationContainer.SetActive(false);
 344    }
 45
 46    public void SetLoading()
 47    {
 148        contentContainer.SetActive(false);
 149        emptyContainer.SetActive(false);
 150        noSearchResultContainer.SetActive(false);
 151        loadingAnimationContainer.SetActive(true);
 152    }
 53
 54    public void SetNoSearchResult()
 55    {
 156        contentContainer.SetActive(false);
 157        emptyContainer.SetActive(false);
 158        noSearchResultContainer.SetActive(true);
 159        loadingAnimationContainer.SetActive(false);
 160    }
 61
 62    public void SetFilled()
 63    {
 564        contentContainer.SetActive(true);
 565        emptyContainer.SetActive(false);
 566        noSearchResultContainer.SetActive(false);
 567        loadingAnimationContainer.SetActive(false);
 568        ResetScrollRect();
 569    }
 70
 71    public void Dispose()
 72    {
 373        if (!isDestroyed)
 74        {
 375            Destroy(gameObject);
 76        }
 377    }
 78}