< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Context(...)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
 25814        public BIWProjectReferences projectReferencesAsset { get;  set; }
 32415        public BIWInputsReferences inputsReferencesAsset { get;  set; }
 16
 17        //Builder Parts
 718        public IBuilderMainPanelController panelHUD { get; internal set; }
 1119        public IBIWEditor editor  { get; internal set; }
 4120        public IBuilderAPIController builderAPIController { get; internal set; }
 721        public ISceneManager sceneManager  { get; internal set; }
 1722        public ICameraController cameraController  { get; internal set; }
 48323        public ISceneReferences sceneReferences { get; internal set; }
 724        public IPublisher publisher { get; internal set; }
 25
 26        //Editor
 330827        public IEditorContext editorContext { get; internal set; }
 28
 22029        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        {
 22050            projectReferencesAsset = Resources.Load<BIWProjectReferences>(PROJECT_REFERENCES_PATH);
 22051            inputsReferencesAsset = Resources.Load<BIWInputsReferences>(INPUTS_PATH);
 52
 22053            this.sceneReferences = sceneReferences;
 54
 55            //Builder parts
 22056            this.panelHUD = panelHUD;
 22057            this.editor = editor;
 22058            this.builderAPIController = builderAPIController;
 22059            this.sceneManager = sceneManager;
 22060            this.cameraController = cameraController;
 22061            this.publisher = publisher;
 62
 22063            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            );
 22078        }
 79
 80        public void Dispose()
 81        {
 10282            editorContext.Dispose();
 10283            panelHUD.Dispose();
 10284            projectReferencesAsset = null;
 10285            inputsReferencesAsset = null;
 10286        }
 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
 94        BIWGodModeDynamicVariables IEditorContext.godModeDynamicVariablesAsset => godModeDynamicVariablesAssetReference;
 95        BIWFirstPersonDynamicVariables IEditorContext.firstPersonDynamicVariablesAsset => firstPersonDynamicVariablesAss
 96
 97        //HUD
 98        public IBuilderEditorHUDController editorHUD { get; private set; }
 99
 100        // BIW Controllers
 101        public IBIWOutlinerController outlinerController { get; private set; }
 102        public IBIWInputHandler inputHandler { get; private set; }
 103        public IBIWInputWrapper inputWrapper { get; private set; }
 104        public IBIWPublishController publishController { get; private set; }
 105        public IBIWCreatorController creatorController { get; private set; }
 106        public IBIWModeController modeController { get; private set; }
 107        public IBIWFloorHandler floorHandler => floorHandlerReference;
 108
 109        internal IBIWFloorHandler floorHandlerReference;
 110        public IBIWEntityHandler entityHandler { get; private set; }
 111        public IBIWActionController actionController { get; private set; }
 112        public IBIWSaveController saveController { get; private set; }
 113        public IBIWRaycastController raycastController { get; private set; }
 114        public IBIWGizmosController gizmosController { get; private set; }
 115        public ISceneReferences sceneReferences { get; private set; }
 116
 117        //Scriptable Objects
 118        internal BIWGodModeDynamicVariables godModeDynamicVariablesAssetReference;
 119        internal BIWFirstPersonDynamicVariables firstPersonDynamicVariablesAssetReference;
 120
 121        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        {
 136            godModeDynamicVariablesAssetReference = Resources.Load<BIWGodModeDynamicVariables>(GOD_MODE_DYNAMIC_VARIABLE
 137            firstPersonDynamicVariablesAssetReference = Resources.Load<BIWFirstPersonDynamicVariables>(FIRST_PERSON_DYNA
 138
 139            this.editorHUD = editorHUD;
 140
 141            this.outlinerController = outlinerController;
 142            this.inputHandler = inputHandler;
 143            this.inputWrapper = inputWrapper;
 144            this.publishController = publishController;
 145            this.creatorController = creatorController;
 146            this.modeController = modeController;
 147            this.floorHandlerReference = floorHandler;
 148            this.entityHandler = entityHandler;
 149            this.actionController = actionController;
 150            this.saveController = saveController;
 151            this.raycastController = raycastController;
 152            this.gizmosController = gizmosController;
 153            this.sceneReferences = sceneReferences;
 154        }
 155
 156        public void Dispose()
 157        {
 158            editorHUD.Dispose();
 159            outlinerController.Dispose();
 160            inputHandler.Dispose();
 161            inputWrapper.Dispose();
 162            publishController.Dispose();
 163            creatorController.Dispose();
 164            modeController.Dispose();
 165            floorHandler.Dispose();
 166            entityHandler.Dispose();
 167            actionController.Dispose();
 168            saveController.Dispose();
 169            raycastController.Dispose();
 170            gizmosController.Dispose();
 171
 172            sceneReferences.Dispose();
 173
 174
 175            godModeDynamicVariablesAssetReference = null;
 176            firstPersonDynamicVariablesAssetReference = null;
 177        }
 178    }
 179}