< Summary

Class:DCL.SettingsCommon.SettingsControllers.SpecificControllers.ShowAvatarNamesControlController
Assembly:SettingsControllers
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/ShowAvatarNamesControlController.cs
Covered lines:7
Uncovered lines:6
Coverable lines:13
Total lines:37
Line coverage:53.8% (7 of 13)
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%110100%
OnDestroy()0%2100%
AvatarNamesVisibleChanged(...)0%2100%

File(s)

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

#LineLine coverage
 1using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 2using UnityEngine;
 3
 4namespace DCL.SettingsCommon.SettingsControllers.SpecificControllers
 5{
 6    [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Show Avatar Names", fileName = "ShowAvatarNamesControlCon
 7    public class ShowAvatarNamesControlController : ToggleSettingsControlController
 8    {
 9        public override void Initialize()
 10        {
 211            base.Initialize();
 12
 213            DataStore.i.HUDs.avatarNamesVisible.OnChange += AvatarNamesVisibleChanged;
 214        }
 15
 216        public override object GetStoredValue() { return currentGeneralSettings.showAvatarNames; }
 17
 18        public override void UpdateSetting(object newValue)
 19        {
 220            currentGeneralSettings.showAvatarNames = (bool)newValue;
 221            DataStore.i.HUDs.avatarNamesVisible.Set(currentGeneralSettings.showAvatarNames);
 222        }
 23
 24        public override void OnDestroy()
 25        {
 026            base.OnDestroy();
 27
 028            DataStore.i.HUDs.avatarNamesVisible.OnChange -= AvatarNamesVisibleChanged;
 029        }
 30
 31        private void AvatarNamesVisibleChanged(bool current, bool previous)
 32        {
 033            currentGeneralSettings.showAvatarNames = current;
 034            ApplySettings();
 035        }
 36    }
 37}