< Summary

Class:DCL.LoadingScreen.LoadingScreenTimeoutView
Assembly:DCL.LoadingScreen
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/LoadingScreen/Scripts/LoadingScreenTimeoutView.cs
Covered lines:0
Uncovered lines:16
Coverable lines:16
Total lines:55
Line coverage:0% (0 of 16)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:4
Method coverage:0% (0 of 4)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%30500%
ShowSceneTimeout()0%2100%
HideSceneTimeout()0%12300%
Dispose()0%12300%

File(s)

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

#LineLine coverage
 1using System;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5namespace DCL.LoadingScreen
 6{
 7    public class LoadingScreenTimeoutView : MonoBehaviour, ILoadingScreenTimeoutView
 8    {
 9        [SerializeField] private GameObject websocketTimeout;
 10        [SerializeField] private GameObject sceneTimeoutWebGL;
 11        [SerializeField] private GameObject sceneTimeoutDesktop;
 12        [SerializeField] private Button[] exitButtons;
 13        [SerializeField] private Button[] goBackHomeButtons;
 14
 15        private GameObject currentSceneTimeoutContainer;
 16        private bool goHomeRequested;
 17
 18        public event Action OnExitButtonClicked;
 19        public event Action OnJumpHomeButtonClicked;
 20
 21        private void Awake()
 22        {
 023            foreach (Button exitButton in exitButtons)
 024                exitButton.onClick.AddListener(() => OnExitButtonClicked?.Invoke());
 25
 026            foreach (Button goBackHomeButton in goBackHomeButtons)
 027                goBackHomeButton.onClick.AddListener(() => OnJumpHomeButtonClicked?.Invoke());
 28
 29            //In desktop, first timeout corresponds to websocket. Thats why we have to define what is the first message 
 030            currentSceneTimeoutContainer = Application.platform == RuntimePlatform.WebGLPlayer ? sceneTimeoutWebGL : web
 031        }
 32
 33        public void ShowSceneTimeout()
 34        {
 035            currentSceneTimeoutContainer.SetActive(true);
 036        }
 37
 38        public void HideSceneTimeout()
 39        {
 040            currentSceneTimeoutContainer.SetActive(false);
 41
 42            //Once the websocket has connected and the first fadeout has been done, its always a scene timeout
 043            currentSceneTimeoutContainer = Application.platform == RuntimePlatform.WebGLPlayer ? sceneTimeoutWebGL : sce
 044        }
 45
 46        public void Dispose()
 47        {
 048            foreach (Button exitButton in exitButtons)
 049                exitButton.onClick.RemoveAllListeners();
 50
 051            foreach (Button goBackHomeButton in goBackHomeButtons)
 052                goBackHomeButton.onClick.RemoveAllListeners();
 053        }
 54    }
 55}