< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CreateView()0%110100%
Awake()0%110100%
SetVisible(...)0%110100%
SetMessage(...)0%110100%
SetPercentage(...)0%110100%
SetWalletPrompt(...)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
 5namespace LoadingHUD
 6{
 7    public interface ILoadingHUDView
 8    {
 9        void SetVisible(bool isVisible);
 10        void SetMessage(string message);
 11        void SetPercentage(float percentage);
 12        void SetWalletPrompt(bool showWalletPrompt);
 13        void SetTips(bool showTips);
 14        void Dispose();
 15    }
 16
 17    public class LoadingHUDView : MonoBehaviour, ILoadingHUDView
 18    {
 19        [SerializeField] internal TextMeshProUGUI text;
 20        [SerializeField] internal Image loadingBar;
 21        [SerializeField] internal GameObject walletPrompt;
 22        [SerializeField] internal GameObject tipsContainer;
 23        [SerializeField] internal GameObject noTipsContainer;
 24
 25        private bool isDestroyed = false;
 26
 27        public static ILoadingHUDView CreateView()
 28        {
 129            LoadingHUDView view = Instantiate(Resources.Load<GameObject>("LoadingHUD")).GetComponent<LoadingHUDView>();
 130            view.gameObject.name = "_LoadingHUD";
 131            return view;
 32        }
 33
 34        private void Awake()
 35        {
 936            SetMessage("");
 937            SetPercentage(0);
 938            SetWalletPrompt(false);
 939            SetTips(false);
 940        }
 41
 842        public void SetVisible(bool isVisible) { gameObject.SetActive(isVisible); }
 2243        public void SetMessage(string message) { text.text = message; }
 2244        public void SetPercentage(float percentage) { loadingBar.transform.localScale = new Vector3(percentage, 1, 1); }
 2245        public void SetWalletPrompt(bool showWalletPrompt) { walletPrompt.gameObject.SetActive(showWalletPrompt); }
 46        public void SetTips(bool showTips)
 47        {
 1248            tipsContainer.gameObject.SetActive(showTips);
 1249            noTipsContainer.gameObject.SetActive(!showTips);
 1250        }
 51
 1852        private void OnDestroy() { isDestroyed = true; }
 53
 54        public void Dispose()
 55        {
 156            if (isDestroyed)
 057                return;
 158            isDestroyed = true;
 159            Destroy(gameObject);
 160        }
 61    }
 62}