< Summary

Class:DCL.SettingsCommon.SettingsControllers.SpecificControllers.ShadowControlController
Assembly:SettingsControllers
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/ShadowControlController.cs
Covered lines:16
Uncovered lines:1
Coverable lines:17
Total lines:49
Line coverage:94.1% (16 of 17)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize()0%2.022083.33%
GetStoredValue()0%110100%
UpdateSetting(...)0%770100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/ShadowControlController.cs

#LineLine coverage
 1using System.Reflection;
 2using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 3using UnityEngine;
 4using UnityEngine.Rendering;
 5using UnityEngine.Rendering.Universal;
 6
 7namespace DCL.SettingsCommon.SettingsControllers.SpecificControllers
 8{
 9    [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Shadow", fileName = "ShadowControlController")]
 10    public class ShadowControlController : ToggleSettingsControlController
 11    {
 12        private UniversalRenderPipelineAsset lightweightRenderPipelineAsset = null;
 13        private FieldInfo lwrpaShadowField = null;
 14
 15        public override void Initialize()
 16        {
 217            base.Initialize();
 18
 219            lightweightRenderPipelineAsset = GraphicsSettings.renderPipelineAsset as UniversalRenderPipelineAsset;
 20
 221            if (lightweightRenderPipelineAsset == null)
 022                return;
 23
 224            lwrpaShadowField = lightweightRenderPipelineAsset.GetType().GetField("m_MainLightShadowsSupported", BindingF
 225        }
 26
 227        public override object GetStoredValue() { return currentQualitySetting.shadows; }
 28
 29        public override void UpdateSetting(object newValue)
 30        {
 231            currentQualitySetting.shadows = (bool)newValue;
 32
 233            if (lightweightRenderPipelineAsset != null)
 234                lwrpaShadowField?.SetValue(lightweightRenderPipelineAsset, currentQualitySetting.shadows);
 35
 236            if (SceneReferences.i.environmentLight)
 37            {
 138                LightShadows shadowType = LightShadows.None;
 39
 140                if (currentQualitySetting.shadows)
 141                    shadowType = currentQualitySetting.shadows ? LightShadows.Soft : LightShadows.Hard;
 42
 143                SceneReferences.i.environmentLight.shadows = shadowType;
 44            }
 45
 246            CommonSettingsScriptableObjects.shadowsDisabled.Set(!currentQualitySetting.shadows);
 247        }
 48    }
 49}