< 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:0
Uncovered lines:12
Coverable lines:12
Total lines:41
Line coverage:0% (0 of 12)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:6
Method coverage:0% (0 of 6)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
LoadingScreenPercentageView()0%2100%
SetLoadingPercentage(...)0%2100%
GetCurrentLoadingMessage(...)0%2100%
SetSceneLoadingMessage()0%2100%
SetPlayerLoadingMessage()0%2100%
SetShaderCompilingMessage(...)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;
 014        private readonly string LOADING_AVATAR_MESSAGE = "Loading avatar...";
 015        private readonly string LOADING_SCENE_MESSAGE = "Loading scenes, 3D models, and sounds... {0}% complete";
 016        private readonly string COMPILING_SHADERS_MESSAGE = "Compiling shaders, this might take a few seconds";
 17        private string currentMessage;
 18
 19        public void SetLoadingPercentage(int percentage)
 20        {
 021            loadingMessage.text = GetCurrentLoadingMessage(percentage);
 022            loadingPercentage.fillAmount = percentage / 100f;
 023        }
 24
 25        internal string GetCurrentLoadingMessage(int percentage) =>
 026            string.Format(currentMessage, percentage);
 27
 28        public void SetSceneLoadingMessage() =>
 029            currentMessage = LOADING_SCENE_MESSAGE;
 30
 31        public void SetPlayerLoadingMessage() =>
 032            currentMessage = LOADING_AVATAR_MESSAGE;
 33
 34        public void SetShaderCompilingMessage(float progress)
 35        {
 036            loadingMessage.text = COMPILING_SHADERS_MESSAGE;
 037            loadingPercentage.fillAmount = progress;
 038        }
 39
 40    }
 41}