< Summary

Class:MainScripts.DCL.Controllers.SettingsDesktop.SettingsControllers.FPSLimitControlController
Assembly:SettingsPanelHUDDesktop
File(s):/tmp/workspace/explorer-desktop/unity-renderer-desktop/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUDDesktop/Scripts/FPSLimitControlController.cs
Covered lines:0
Uncovered lines:17
Coverable lines:17
Total lines:43
Line coverage:0% (0 of 17)
Covered branches:0
Total branches:0

Metrics

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

File(s)

/tmp/workspace/explorer-desktop/unity-renderer-desktop/Assets/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        int[] allFpsValues;
 9
 10        public override void Initialize()
 11        {
 012            allFpsValues = (int[])System.Enum.GetValues(typeof(FpsCapMode));
 013            base.Initialize();
 014            SetupLabels();
 015        }
 16
 017        public override object GetStoredValue() { return currentDisplaySettings.fpsCapIndex; }
 18
 19        private void SetupLabels()
 20        {
 021            var length = allFpsValues.Length;
 022            var fpsLabels = new string[length];
 023            for (var i = 0; i < length; i++)
 24            {
 025                fpsLabels[i] = allFpsValues[i] > 0 ? allFpsValues[i].ToString() + " FPS" : "Max";
 26            }
 27
 028            RaiseOnOverrideIndicatorLabel(fpsLabels);
 029        }
 30
 31        public override void UpdateSetting(object newValue)
 32        {
 033            var fpsValue = (int)allFpsValues[(int)newValue];
 034            currentDisplaySettings.fpsCapIndex = (int)newValue;
 035            ToggleFPSCap(fpsValue);
 036        }
 37
 38        public static void ToggleFPSCap(int fpsValue)
 39        {
 040            Application.targetFrameRate = fpsValue;
 041        }
 42    }
 43}