< Summary

Class:DCL.LoadingScreen.LoadingScreenPercentageView
Assembly:DCL.LoadingScreen
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/LoadingScreen/Scripts/LoadingScreenPercentageView.cs
Covered lines:2
Uncovered lines:6
Coverable lines:8
Total lines:33
Line coverage:25% (2 of 8)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
LoadingScreenPercentageView()0%110100%
SetLoadingPercentage(...)0%2100%
GetCurrentLoadingMessage(...)0%2100%
SetSceneLoadingMessage()0%2100%
SetPlayerLoadingMessage()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/LoadingScreen/Scripts/LoadingScreenPercentageView.cs

#LineLine coverage
 1using TMPro;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5namespace DCL.LoadingScreen
 6{
 7    /// <summary>
 8    ///     View responsible of showing the corresponding loading percentage and message provided by LoadingScreenPercen
 9    /// </summary>
 10    public class LoadingScreenPercentageView : MonoBehaviour
 11    {
 12        [SerializeField] internal TMP_Text loadingMessage;
 13        [SerializeField] internal Image loadingPercentage;
 114        private readonly string LOADING_AVATAR_MESSAGE = "Loading avatar...";
 115        private readonly string LOADING_SCENE_MESSAGE = "Loading scenes, 3D models, and sounds... {0}% complete";
 16        private string currentMessage;
 17
 18        public void SetLoadingPercentage(int percentage)
 19        {
 020            loadingMessage.text = GetCurrentLoadingMessage(percentage);
 021            loadingPercentage.fillAmount = percentage / 100f;
 022        }
 23
 24        internal string GetCurrentLoadingMessage(int percentage) =>
 025            string.Format(currentMessage, percentage);
 26
 27        public void SetSceneLoadingMessage() =>
 028            currentMessage = LOADING_SCENE_MESSAGE;
 29
 30        public void SetPlayerLoadingMessage() =>
 031            currentMessage = LOADING_AVATAR_MESSAGE;
 32    }
 33}