< Summary

Class:DCL.Builder.EditorContext
Assembly:BIWContext
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/Context/Context.cs
Covered lines:50
Uncovered lines:1
Coverable lines:51
Total lines:179
Line coverage:98% (50 of 51)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
get_godModeDynamicVariablesAsset()0%110100%
get_firstPersonDynamicVariablesAsset()0%110100%
EditorContext(...)0%110100%
Dispose()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/Context/Context.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using DCL;
 4using UnityEngine;
 5
 6namespace DCL.Builder
 7{
 8    public class Context : IContext
 9    {
 10        private const string PROJECT_REFERENCES_PATH = "ScriptableObjects/ProjectReferences";
 11        private const string INPUTS_PATH = "ScriptableObjects/InputReferences";
 12
 13        //Scriptable Objects
 14        public BIWProjectReferences projectReferencesAsset { get;  set; }
 15        public BIWInputsReferences inputsReferencesAsset { get;  set; }
 16
 17        //Builder Parts
 18        public IBuilderMainPanelController panelHUD { get; internal set; }
 19        public IBIWEditor editor  { get; internal set; }
 20        public IBuilderAPIController builderAPIController { get; internal set; }
 21        public ISceneManager sceneManager  { get; internal set; }
 22        public ICameraController cameraController  { get; internal set; }
 23        public ISceneReferences sceneReferences { get; internal set; }
 24        public IPublisher publisher { get; internal set; }
 25
 26        //Editor
 27        public IEditorContext editorContext { get; internal set; }
 28
 29        public Context(IBIWEditor editor,
 30            IBuilderMainPanelController panelHUD,
 31            IBuilderAPIController builderAPIController,
 32            ISceneManager sceneManager,
 33            ICameraController cameraController,
 34            IPublisher publisher,
 35            IBuilderEditorHUDController editorHUD,
 36            IBIWOutlinerController outlinerController,
 37            IBIWInputHandler inputHandler,
 38            IBIWInputWrapper inputWrapper,
 39            IBIWPublishController publishController,
 40            IBIWCreatorController creatorController,
 41            IBIWModeController modeController,
 42            IBIWFloorHandler floorHandler,
 43            IBIWEntityHandler entityHandler,
 44            IBIWActionController actionController,
 45            IBIWSaveController saveController,
 46            IBIWRaycastController raycastController,
 47            IBIWGizmosController gizmosController,
 48            ISceneReferences sceneReferences)
 49        {
 50            projectReferencesAsset = Resources.Load<BIWProjectReferences>(PROJECT_REFERENCES_PATH);
 51            inputsReferencesAsset = Resources.Load<BIWInputsReferences>(INPUTS_PATH);
 52
 53            this.sceneReferences = sceneReferences;
 54
 55            //Builder parts
 56            this.panelHUD = panelHUD;
 57            this.editor = editor;
 58            this.builderAPIController = builderAPIController;
 59            this.sceneManager = sceneManager;
 60            this.cameraController = cameraController;
 61            this.publisher = publisher;
 62
 63            editorContext = new EditorContext(editorHUD,
 64                outlinerController,
 65                inputHandler,
 66                inputWrapper,
 67                publishController,
 68                creatorController,
 69                modeController,
 70                floorHandler,
 71                entityHandler,
 72                actionController,
 73                saveController,
 74                raycastController,
 75                gizmosController,
 76                sceneReferences
 77            );
 78        }
 79
 80        public void Dispose()
 81        {
 82            editorContext.Dispose();
 83            panelHUD.Dispose();
 84            projectReferencesAsset = null;
 85            inputsReferencesAsset = null;
 86        }
 87    }
 88
 89    public class EditorContext : IEditorContext
 90    {
 91        private const string GOD_MODE_DYNAMIC_VARIABLE_PATH = "ScriptableObjects/GodModeVariables";
 92        private const string FIRST_PERSON_DYNAMIC_VARIABLE_PATH = "ScriptableObjects/FirstPersonVariables";
 93
 21094        BIWGodModeDynamicVariables IEditorContext.godModeDynamicVariablesAsset => godModeDynamicVariablesAssetReference;
 27295        BIWFirstPersonDynamicVariables IEditorContext.firstPersonDynamicVariablesAsset => firstPersonDynamicVariablesAss
 96
 97        //HUD
 163498        public IBuilderEditorHUDController editorHUD { get; private set; }
 99
 100        // BIW Controllers
 115101        public IBIWOutlinerController outlinerController { get; private set; }
 8102        public IBIWInputHandler inputHandler { get; private set; }
 8103        public IBIWInputWrapper inputWrapper { get; private set; }
 8104        public IBIWPublishController publishController { get; private set; }
 107105        public IBIWCreatorController creatorController { get; private set; }
 134106        public IBIWModeController modeController { get; private set; }
 48107        public IBIWFloorHandler floorHandler => floorHandlerReference;
 108
 109        internal IBIWFloorHandler floorHandlerReference;
 206110        public IBIWEntityHandler entityHandler { get; private set; }
 214111        public IBIWActionController actionController { get; private set; }
 94112        public IBIWSaveController saveController { get; private set; }
 206113        public IBIWRaycastController raycastController { get; private set; }
 42114        public IBIWGizmosController gizmosController { get; private set; }
 0115        public ISceneReferences sceneReferences { get; private set; }
 116
 117        //Scriptable Objects
 118        internal BIWGodModeDynamicVariables godModeDynamicVariablesAssetReference;
 119        internal BIWFirstPersonDynamicVariables firstPersonDynamicVariablesAssetReference;
 120
 220121        public EditorContext(IBuilderEditorHUDController editorHUD,
 122            IBIWOutlinerController outlinerController,
 123            IBIWInputHandler inputHandler,
 124            IBIWInputWrapper inputWrapper,
 125            IBIWPublishController publishController,
 126            IBIWCreatorController creatorController,
 127            IBIWModeController modeController,
 128            IBIWFloorHandler floorHandler,
 129            IBIWEntityHandler entityHandler,
 130            IBIWActionController actionController,
 131            IBIWSaveController saveController,
 132            IBIWRaycastController raycastController,
 133            IBIWGizmosController gizmosController,
 134            ISceneReferences sceneReferences)
 135        {
 220136            godModeDynamicVariablesAssetReference = Resources.Load<BIWGodModeDynamicVariables>(GOD_MODE_DYNAMIC_VARIABLE
 220137            firstPersonDynamicVariablesAssetReference = Resources.Load<BIWFirstPersonDynamicVariables>(FIRST_PERSON_DYNA
 138
 220139            this.editorHUD = editorHUD;
 140
 220141            this.outlinerController = outlinerController;
 220142            this.inputHandler = inputHandler;
 220143            this.inputWrapper = inputWrapper;
 220144            this.publishController = publishController;
 220145            this.creatorController = creatorController;
 220146            this.modeController = modeController;
 220147            this.floorHandlerReference = floorHandler;
 220148            this.entityHandler = entityHandler;
 220149            this.actionController = actionController;
 220150            this.saveController = saveController;
 220151            this.raycastController = raycastController;
 220152            this.gizmosController = gizmosController;
 220153            this.sceneReferences = sceneReferences;
 220154        }
 155
 156        public void Dispose()
 157        {
 102158            editorHUD.Dispose();
 102159            outlinerController.Dispose();
 102160            inputHandler.Dispose();
 102161            inputWrapper.Dispose();
 102162            publishController.Dispose();
 102163            creatorController.Dispose();
 102164            modeController.Dispose();
 102165            floorHandler.Dispose();
 102166            entityHandler.Dispose();
 102167            actionController.Dispose();
 102168            saveController.Dispose();
 102169            raycastController.Dispose();
 102170            gizmosController.Dispose();
 171
 102172            sceneReferences.Dispose();
 173
 174
 102175            godModeDynamicVariablesAssetReference = null;
 102176            firstPersonDynamicVariablesAssetReference = null;
 102177        }
 178    }
 179}