< Summary

Class:DCL.SettingsCommon.SettingsControllers.SpecificControllers.NightModeControlController
Assembly:SettingsControllers
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/NightModeControlController.cs
Covered lines:12
Uncovered lines:3
Coverable lines:15
Total lines:39
Line coverage:80% (12 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize()0%110100%
GetStoredValue()0%110100%
UpdateSetting(...)0%330100%
OnDestroy()0%2100%
OnChangeProfile(...)0%110100%

File(s)

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

#LineLine coverage
 1using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 2using UnityEngine;
 3
 4namespace DCL.SettingsCommon.SettingsControllers.SpecificControllers
 5{
 6    [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Night Mode", fileName = "NightModeControlController")]
 7    public class NightModeControlController : ToggleSettingsControlController
 8    {
 9        public override void Initialize()
 10        {
 211            base.Initialize();
 12
 213            RenderProfileManifest.i.OnChangeProfile += OnChangeProfile;
 214            OnChangeProfile(RenderProfileManifest.i.currentProfile);
 215        }
 16
 217        public override object GetStoredValue() { return currentGeneralSettings.nightMode; }
 18
 19        public override void UpdateSetting(object newValue)
 20        {
 221            currentGeneralSettings.nightMode = (bool)newValue;
 222            RenderProfileManifest.i.currentProfile = currentGeneralSettings.nightMode ? RenderProfileManifest.i.nightPro
 223            RenderProfileManifest.i.currentProfile.Apply();
 224        }
 25
 26        public override void OnDestroy()
 27        {
 028            base.OnDestroy();
 29
 030            RenderProfileManifest.i.OnChangeProfile -= OnChangeProfile;
 031        }
 32
 33        private void OnChangeProfile(RenderProfileWorld profile)
 34        {
 4635            currentGeneralSettings.nightMode = profile == RenderProfileManifest.i.nightProfile;
 4636            ApplySettings();
 4637        }
 38    }
 39}