< Summary

Class:DCL.Main
Assembly:Main
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Scene/Main/Main.cs
Covered lines:17
Uncovered lines:21
Coverable lines:38
Total lines:119
Line coverage:44.7% (17 of 38)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%4.844062.5%
SetupEnvironment()0%2100%
MessagingContextBuilder()0%2100%
PlatformContextBuilder()0%2100%
WorldRuntimeContextBuilder()0%2100%
HUDContextBuilder()0%2100%
Start()0%110100%
Update()0%2.062075%
LateUpdate()0%110100%
OnDestroy()0%2.152066.67%
LoadParcelScenes(...)0%2100%
SendSceneMessage(...)0%2100%
UnloadScene(...)0%2100%
CreateGlobalScene(...)0%2100%
UpdateParcelScenes(...)0%2100%
BuilderReady()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Scene/Main/Main.cs

#LineLine coverage
 1using System;
 2using DCL.Components;
 3using DCL.Controllers;
 4using DCL.Helpers;
 5using UnityEngine;
 6using UnityEngine.Serialization;
 7
 8namespace DCL
 9{
 10    /// <summary>
 11    /// This is the InitialScene entry point.
 12    /// Most of the application subsystems should be initialized from this class Awake() event.
 13    /// </summary>
 14    public class Main : MonoBehaviour
 15    {
 016        public static Main i { get; private set; }
 17
 18        public PoolableComponentFactory componentFactory;
 19
 20        public DebugConfig debugConfig;
 21
 22        private PerformanceMetricsController performanceMetricsController;
 23        private EntryPoint_World worldEntryPoint;
 24
 25        void Awake()
 26        {
 10527            if (i != null)
 28            {
 029                Utils.SafeDestroy(this);
 030                return;
 31            }
 32
 10533            i = this;
 34
 10535            DataStore.i.debugConfig.soloScene = debugConfig.soloScene;
 10536            DataStore.i.debugConfig.soloSceneCoords = debugConfig.soloSceneCoords;
 10537            DataStore.i.debugConfig.ignoreGlobalScenes = debugConfig.ignoreGlobalScenes;
 10538            DataStore.i.debugConfig.msgStepByStep = debugConfig.msgStepByStep;
 39
 10540            if (!Configuration.EnvironmentSettings.RUNNING_TESTS)
 41            {
 042                performanceMetricsController = new PerformanceMetricsController();
 043                RenderProfileManifest.i.Initialize();
 044                SetupEnvironment();
 45            }
 46
 10547            DCL.Interface.WebInterface.SendSystemInfoReport();
 48
 49#if !UNITY_EDITOR
 50            Debug.Log("DCL Unity Build Version: " + DCL.Configuration.ApplicationSettings.version);
 51            Debug.unityLogger.logEnabled = false;
 52
 53            worldEntryPoint = new EntryPoint_World(Environment.i.world.sceneController);
 54#endif
 55
 56            // TODO(Brian): This is a temporary fix to address elevators issue in the xmas event.
 57            // We should re-enable this later as produces a performance regression.
 10558            if (!Configuration.EnvironmentSettings.RUNNING_TESTS)
 059                Environment.i.platform.cullingController.SetAnimationCulling(false);
 10560        }
 61
 62        protected virtual void SetupEnvironment()
 63        {
 064            Environment.SetupWithBuilders(
 65                messagingBuilder: MessagingContextBuilder,
 66                platformBuilder: PlatformContextBuilder,
 67                worldRuntimeBuilder: WorldRuntimeContextBuilder,
 68                hudBuilder: HUDContextBuilder);
 069        }
 70        protected virtual MessagingContext MessagingContextBuilder()
 71        {
 072            return MessagingContextFactory.CreateDefault();
 73        }
 74        protected virtual PlatformContext PlatformContextBuilder()
 75        {
 076            return PlatformContextFactory.CreateDefault();
 77        }
 78        protected virtual WorldRuntimeContext WorldRuntimeContextBuilder()
 79        {
 080            return WorldRuntimeContextFactory.CreateDefault(componentFactory);
 81        }
 82        protected virtual HUDContext HUDContextBuilder()
 83        {
 084            return HUDContextFactory.CreateDefault();
 85        }
 21086        private void Start() { Environment.i.world.sceneController.Start(); }
 87
 88        private void Update()
 89        {
 1394890            Environment.i.platform.idleChecker.Update();
 1394891            Environment.i.world.sceneController.Update();
 1394892            performanceMetricsController?.Update();
 093        }
 94
 2789495        private void LateUpdate() { Environment.i.world.sceneController.LateUpdate(); }
 96
 97        private void OnDestroy()
 98        {
 10499            if (!Configuration.EnvironmentSettings.RUNNING_TESTS)
 0100                Environment.Dispose();
 104101        }
 102
 103        #region RuntimeMessagingBridge
 104
 0105        public void LoadParcelScenes(string payload) { Environment.i.world.sceneController.LoadParcelScenes(payload); }
 106
 0107        public void SendSceneMessage(string payload) { Environment.i.world.sceneController.SendSceneMessage(payload); }
 108
 0109        public void UnloadScene(string sceneId) { Environment.i.world.sceneController.UnloadScene(sceneId); }
 110
 0111        public void CreateGlobalScene(string payload) { Environment.i.world.sceneController.CreateGlobalScene(payload); 
 112
 0113        public void UpdateParcelScenes(string payload) { Environment.i.world.sceneController.UpdateParcelScenes(payload)
 114
 115        #endregion
 116
 0117        public void BuilderReady() { UnityEngine.SceneManagement.SceneManager.LoadScene("BuilderScene", UnityEngine.Scen
 118    }
 119}