< Summary

Class:DCLPlugins.LoadingScreenPlugin.LoadingScreenPlugin
Assembly:DCLPlugins.LoadingScreenPlugin
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/LoadingScreenPlugin/LoadingScreenPlugin.cs
Covered lines:0
Uncovered lines:12
Coverable lines:12
Total lines:50
Line coverage:0% (0 of 12)
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
LoadingScreenPlugin()0%2100%
CreateLoadingScreen()0%2100%
Dispose()0%2100%
CreateLoadingScreenView()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/LoadingScreenPlugin/LoadingScreenPlugin.cs

#LineLine coverage
 1using Cysharp.Threading.Tasks;
 2using DCL;
 3using DCL.LoadingScreen;
 4using DCL.Providers;
 5using MainScripts.DCL.Controllers.ShaderPrewarm;
 6using System.Threading;
 7using UnityEngine;
 8
 9namespace DCLPlugins.LoadingScreenPlugin
 10{
 11    /// <summary>
 12    /// Plugin controller for the decoupled Loading Screen
 13    /// </summary>
 14    public class LoadingScreenPlugin : IPlugin
 15    {
 16        private const string LOADING_SCREEN_ASSET = "_LoadingScreen";
 17
 18        private readonly DataStoreRef<DataStore_LoadingScreen> dataStoreLoadingScreen;
 19        private readonly CancellationTokenSource cancellationTokenSource;
 20
 21        private LoadingScreenController loadingScreenController;
 22
 023        public LoadingScreenPlugin()
 24        {
 025            dataStoreLoadingScreen.Ref.decoupledLoadingHUD.visible.Set(true);
 26
 027            cancellationTokenSource = new CancellationTokenSource();
 028            CreateLoadingScreen(cancellationTokenSource.Token).Forget();
 029        }
 30
 31        private async UniTaskVoid CreateLoadingScreen(CancellationToken cancellationToken = default)
 32        {
 033            loadingScreenController = new LoadingScreenController(
 34                CreateLoadingScreenView(),
 35                Environment.i.world.sceneController, Environment.i.world.state, NotificationsController.i,
 36                DataStore.i.player, DataStore.i.common, dataStoreLoadingScreen.Ref, DataStore.i.realm, new ShaderPrewarm
 037        }
 38
 39        public void Dispose()
 40        {
 041            cancellationTokenSource.Cancel();
 042            cancellationTokenSource.Dispose();
 43
 044            loadingScreenController.Dispose();
 045        }
 46
 47        public static LoadingScreenView CreateLoadingScreenView() =>
 048            GameObject.Instantiate(Resources.Load<GameObject>(LOADING_SCREEN_ASSET)).GetComponent<LoadingScreenView>();
 49    }
 50}