< Summary

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

Metrics

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

File(s)

/tmp/workspace/explorer-desktop/unity-renderer-desktop/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUDDesktop/Scripts/WindowModeControlController.cs

#LineLine coverage
 1using System;
 2using MainScripts.DCL.Controllers.SettingsDesktop;
 3using MainScripts.DCL.Controllers.SettingsDesktop.SettingsControllers;
 4using MainScripts.DCL.ScriptableObjectsDesktop;
 5using UnityEngine;
 6
 7namespace MainScripts.DCL.Controllers.HUD.SettingsPanelHUDDesktop.Scripts
 8{
 9    [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Window Mode",
 10        fileName = "WindowModeControlController")]
 11    public class WindowModeControlController : SpinBoxSettingsControlControllerDesktop
 12    {
 13        public override object GetStoredValue()
 14        {
 015            return (int)currentDisplaySettings.windowMode;
 16        }
 17
 18        public override void UpdateSetting(object newValue)
 19        {
 020            currentDisplaySettings.windowMode = (WindowMode)(int)newValue;
 021            switch (currentDisplaySettings.windowMode)
 22            {
 23                case WindowMode.Windowed:
 24                case WindowMode.FullScreen:
 025                    UpdateResolution();
 026                    break;
 27                case WindowMode.Borderless:
 028                    SetupBorderless();
 029                    break;
 30                default:
 031                    throw new ArgumentOutOfRangeException();
 32            }
 33
 034            CommonScriptableObjectsDesktop.disableVSync.Set(currentDisplaySettings.windowMode == WindowMode.Windowed);
 035            CommonScriptableObjectsDesktop.disableScreenResolution.Set(currentDisplaySettings.windowMode == WindowMode.B
 036        }
 37
 38        private void SetupBorderless()
 39        {
 040            currentDisplaySettings.resolutionSizeIndex = 0;
 041            ApplySettings();
 042            UpdateResolution();
 043        }
 44
 45        private void UpdateResolution()
 46        {
 047            ScreenResolutionUtils.Apply(currentDisplaySettings);
 048        }
 49    }
 50}