< Summary

Class:MainScripts.DCL.Controllers.SettingsDesktop.SettingsControllers.FPSLimitControlController
Assembly:SettingsPanelHUDDesktop
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Desktop/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUDDesktop/Scripts/FPSLimitControlController.cs
Covered lines:0
Uncovered lines:15
Coverable lines:15
Total lines:39
Line coverage:0% (0 of 15)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:4
Method coverage:0% (0 of 4)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize()0%2100%
GetStoredValue()0%2100%
SetupLabels()0%20400%
UpdateSetting(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Desktop/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUDDesktop/Scripts/FPSLimitControlController.cs

#LineLine coverage
 1using UnityEngine;
 2
 3namespace MainScripts.DCL.Controllers.SettingsDesktop.SettingsControllers
 4{
 5    [CreateAssetMenu(menuName = "Settings/Controllers/Controls/FPS Limit", fileName = "FPSLimitControlController")]
 6    public class FPSLimitControlController : SpinBoxSettingsControlControllerDesktop
 7    {
 8        private int[] allFpsValues;
 9
 10        public override void Initialize()
 11        {
 012            allFpsValues = (int[])System.Enum.GetValues(typeof(FpsCapMode));
 013            base.Initialize();
 014            SetupLabels();
 015        }
 16
 17        public override object GetStoredValue() =>
 018            currentDisplaySettings.fpsCapIndex;
 19
 20        private void SetupLabels()
 21        {
 022            int length = allFpsValues.Length;
 023            var fpsLabels = new string[length];
 24
 025            for (var i = 0; i < length; i++)
 026                fpsLabels[i] = allFpsValues[i] > 0 ? allFpsValues[i] + " FPS" : "Max";
 27
 028            RaiseOnOverrideIndicatorLabel(fpsLabels);
 029        }
 30
 31        public override void UpdateSetting(object newValue)
 32        {
 033            currentDisplaySettings.fpsCapIndex = (int)newValue;
 034            Application.targetFrameRate = allFpsValues[(int)newValue];
 35
 036            ApplySettings();
 037        }
 38    }
 39}