< Summary

Class:DCL.Components.UIReferencesContainer
Assembly:MainScripts
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/UI/UIReferencesContainer.cs
Covered lines:7
Uncovered lines:4
Coverable lines:11
Total lines:61
Line coverage:63.6% (7 of 11)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
OnPointerDown(...)0%4.374071.43%
LateUpdate()0%2.52050%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/UI/UIReferencesContainer.cs

#LineLine coverage
 1using System.Diagnostics.Tracing;
 2using UnityEngine;
 3using UnityEngine.UI;
 4using UnityEngine.EventSystems;
 5using DCL.Interface;
 6
 7namespace DCL.Components
 8{
 9    public class UIReferencesContainer : MonoBehaviour, IPointerDownHandler
 10    {
 11        [System.NonSerialized] public UIShape owner;
 12
 13        [Header("Basic Fields")]
 14        [Tooltip("This needs to always have the root RectTransform.")]
 15        public RectTransform rectTransform;
 16
 17        public CanvasGroup canvasGroup;
 18
 19        public HorizontalLayoutGroup layoutGroup;
 20        public LayoutElement layoutElement;
 21        public RectTransform layoutElementRT;
 22
 23        [Tooltip("Children of this UI object will reparent to this rectTransform.")]
 24        public RectTransform childHookRectTransform;
 25
 26        bool VERBOSE = false;
 27
 28        public void OnPointerDown(PointerEventData eventData)
 29        {
 15630            UIShape.Model ownerModel = (UIShape.Model) owner.GetModel();
 31
 15632            if (VERBOSE)
 33            {
 034                Debug.Log("pointer current raycast: " + eventData.pointerCurrentRaycast,
 35                    eventData.pointerCurrentRaycast.gameObject);
 036                Debug.Log("pointer press raycast: " + eventData.pointerPressRaycast,
 37                    eventData.pointerPressRaycast.gameObject);
 38            }
 39
 15640            if (!string.IsNullOrEmpty(ownerModel.onClick) &&
 41                eventData.pointerPressRaycast.gameObject == childHookRectTransform.gameObject)
 42            {
 643                WebInterface.ReportOnClickEvent(owner.scene.sceneData.id, ownerModel.onClick);
 44            }
 15645        }
 46
 47#if UNITY_EDITOR
 48        [Header("Debug")]
 49        public bool forceRefresh;
 50
 51        public void LateUpdate()
 52        {
 149453            if (forceRefresh)
 54            {
 055                owner.RefreshAll();
 056                forceRefresh = false;
 57            }
 149458        }
 59#endif
 60    }
 61}