< Summary

Class:LoadingHUDView
Assembly:LoadingHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/LoadingHUD/LoadingHUDView.cs
Covered lines:18
Uncovered lines:1
Coverable lines:19
Total lines:46
Line coverage:94.7% (18 of 19)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CreateView()0%110100%
Initialize()0%110100%
SetVisible(...)0%110100%
SetMessage(...)0%110100%
SetPercentage(...)0%110100%
SetTips(...)0%110100%
OnDestroy()0%110100%
Dispose()0%2.032080%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/LoadingHUD/LoadingHUDView.cs

#LineLine coverage
 1using TMPro;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5    public class LoadingHUDView : MonoBehaviour
 6    {
 7        [SerializeField] internal TextMeshProUGUI text;
 8        [SerializeField] internal Image loadingBar;
 9        [SerializeField] internal GameObject tipsContainer;
 10        [SerializeField] internal GameObject noTipsContainer;
 11
 12        private bool isDestroyed = false;
 13
 14        public static LoadingHUDView CreateView()
 15        {
 616            LoadingHUDView view = Instantiate(Resources.Load<GameObject>("LoadingHUD")).GetComponent<LoadingHUDView>();
 617            view.gameObject.name = "_LoadingHUD";
 618            return view;
 19        }
 20
 21        public void Initialize()
 22        {
 723            SetMessage("");
 724            SetPercentage(0);
 725            SetTips(false);
 726        }
 27
 2228        public void SetVisible(bool isVisible) { gameObject.SetActive(isVisible); }
 3029        public void SetMessage(string message) { text.text = message; }
 2830        public void SetPercentage(float percentage) { loadingBar.transform.localScale = new Vector3(percentage, 1, 1); }
 31        public void SetTips(bool showTips)
 32        {
 1633            tipsContainer.gameObject.SetActive(showTips);
 1634            noTipsContainer.gameObject.SetActive(!showTips);
 1635        }
 36
 2637        private void OnDestroy() { isDestroyed = true; }
 38
 39        public void Dispose()
 40        {
 141            if (isDestroyed)
 042                return;
 143            isDestroyed = true;
 144            Destroy(gameObject);
 145        }
 46    }