< Summary

Class:DCL.Controllers.LoadingScreenV2.HintView
Assembly:DCL.LoadingScreenV2
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/LoadingScreenV2/LoadingScreenScripts/HintView.cs
Covered lines:0
Uncovered lines:15
Coverable lines:15
Total lines:46
Line coverage:0% (0 of 15)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:2
Method coverage:0% (0 of 2)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize(...)0%20400%
ToggleHint(...)0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/LoadingScreenV2/LoadingScreenScripts/HintView.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using TMPro;
 3using UnityEngine;
 4using UnityEngine.Serialization;
 5using UnityEngine.UI;
 6
 7namespace DCL.Controllers.LoadingScreenV2
 8{
 9    /// <summary>
 10    /// View responsible of showing the corresponding provided Hint by LoadingScreenHintsController
 11    /// </summary>
 12    public class HintView : MonoBehaviour, IHintView
 13    {
 14        [SerializeField] internal TMP_Text hintText;
 15        [SerializeField] internal Image hintImage;
 16
 17        public void Initialize(Hint hint, Texture2D texture, bool startAsActive = false)
 18        {
 19            try
 20            {
 021                if (hintText == null)
 022                    throw new System.Exception("HintView - HintText is not assigned!");
 023                if (hintImage == null)
 024                    throw new System.Exception("HintView - HintImage is not assigned!");
 025            }
 26            catch (System.Exception e)
 27            {
 028                Debug.LogError(e);
 029                throw;
 30            }
 31
 032            hintText.text = hint.Title;
 33
 034            if (texture != null)
 035                hintImage.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
 36
 037            ToggleHint(startAsActive);
 038        }
 39
 40        public void ToggleHint(bool active)
 41        {
 042            if (this != null)
 043                gameObject.SetActive(active);
 044        }
 45    }
 46}