< Summary

Class:DCL.Components.UIInputTextRefContainer
Assembly:MainScripts
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/UI/UIInputText/UIInputTextRefContainer.cs
Covered lines:12
Uncovered lines:5
Coverable lines:17
Total lines:58
Line coverage:70.5% (12 of 17)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Start()0%110100%
OnSelect(...)0%110100%
Update()0%18.967037.5%

File(s)

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

#LineLine coverage
 1using TMPro;
 2using UnityEngine;
 3using UnityEngine.UI;
 4using UnityEngine.EventSystems;
 5
 6namespace DCL.Components
 7{
 8    public class UIInputTextRefContainer : UIReferencesContainer
 9    {
 10        [Header("Input Text Fields")]
 11        public RawImage bgImage;
 12
 13        public TMP_Text text;
 14        public TMP_InputField inputField;
 15
 16        [System.NonSerialized]
 17        public MouseCatcher mouseCatcher;
 18
 19        [System.NonSerialized]
 20        public int inputDetectionPausedFrames = 0;
 21
 22        void Start()
 23        {
 1024            mouseCatcher = FindObjectOfType<MouseCatcher>();
 25
 1026            inputField.onSelect.AddListener(OnSelect);
 1027        }
 28
 29        void OnSelect(string str)
 30        {
 131            PointerEventData pointerEventData = new PointerEventData(EventSystem.current);
 132            RaycastResult raycastResult = new RaycastResult();
 133            raycastResult.gameObject = text.gameObject;
 134            pointerEventData.pointerPressRaycast = raycastResult;
 35
 136            OnPointerDown(pointerEventData);
 137        }
 38
 39        void Update()
 40        {
 6341            if (inputDetectionPausedFrames > 0)
 42            {
 043                inputDetectionPausedFrames--;
 44
 045                return;
 46            }
 47
 6348            if (Input.GetKeyDown(KeyCode.Return))
 49            {
 050                if (owner != null && owner.scene != null && owner.scene.isPersistent && !inputField.isFocused)
 51                {
 052                    inputField.Select();
 053                    mouseCatcher.UnlockCursor();
 54                }
 55            }
 6356        }
 57    }
 58}