< Summary

Class:MainScripts.DCL.Controllers.HUD.Preloading.PreloadingController
Assembly:Preloading
File(s):/tmp/workspace/explorer-desktop/unity-renderer-desktop/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Preloading/PreloadingController.cs
Covered lines:0
Uncovered lines:20
Coverable lines:20
Total lines:52
Line coverage:0% (0 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PreloadingController()0%2100%
GetView()0%2100%
Dispose()0%6200%
OnMessageChange(...)0%6200%
SignUpFlowChanged(...)0%6200%

File(s)

/tmp/workspace/explorer-desktop/unity-renderer-desktop/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Preloading/PreloadingController.cs

#LineLine coverage
 1using System;
 2using DCL;
 3using UnityEngine;
 4using Object = UnityEngine.Object;
 5
 6namespace MainScripts.DCL.Controllers.HUD.Preloading
 7{
 8    public class PreloadingController : IDisposable
 9    {
 10        private GameObject view;
 011        private BaseVariable<string> loadingMessage => DataStore.i.HUDs.loadingHUD.message;
 012        private BaseVariable<bool> isSignUpFlow => DataStore.i.common.isSignUpFlow;
 13        private bool isDisposed = false;
 14
 015        public PreloadingController()
 16        {
 017            view = Object.Instantiate(GetView());
 018            loadingMessage.OnChange += OnMessageChange;
 019            isSignUpFlow.OnChange += SignUpFlowChanged;
 020        }
 21
 22        private GameObject GetView()
 23        {
 024            return Resources.Load<GameObject>("Preloading");
 25        }
 26
 27        public void Dispose()
 28        {
 029            if (isDisposed) return;
 030            isDisposed = true;
 031            loadingMessage.OnChange -= OnMessageChange;
 032            isSignUpFlow.OnChange -= SignUpFlowChanged;
 033            Object.Destroy(view.gameObject);
 034        }
 35
 36        private void OnMessageChange(string current, string previous)
 37        {
 038            if (current.Contains("%"))
 39            {
 040                Dispose();
 41            }
 042        }
 43
 44        private void SignUpFlowChanged(bool current, bool previous)
 45        {
 046            if (current)
 47            {
 048                Dispose();
 49            }
 050        }
 51    }
 52}