< Summary

Class:GraphicCardWarningHUDController
Assembly:GraphicCardWarningHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/GraphicCardWarningHUD/GraphicCardWarningHUDController.cs
Covered lines:10
Uncovered lines:17
Coverable lines:27
Total lines:67
Line coverage:37% (10 of 27)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GraphicCardWarningHUDController()0%2100%
SetVisibility(...)0%7.355054.55%
TutorialActiveChanged(...)0%6200%
RendererStateChanged(...)0%6200%
TryShowNotification()0%3.333066.67%
IsIntegratedGraphicCard()0%110100%
Dispose()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/GraphicCardWarningHUD/GraphicCardWarningHUDController.cs

#LineLine coverage
 1public class GraphicCardWarningHUDController : IHUD
 2{
 3    private const string GRAPHIC_CARD_MESSAGE = "Your machine is not using a dedicated graphics card to run Decentraland
 4
 05    public GraphicCardWarningHUDController() { }
 6
 7    public void SetVisibility(bool visible)
 8    {
 19        CommonScriptableObjects.tutorialActive.OnChange -= TutorialActiveChanged;
 110        CommonScriptableObjects.rendererState.OnChange -= RendererStateChanged;
 11
 112        if (!visible)
 013            return;
 14
 115        if (!CommonScriptableObjects.tutorialActive.Get() && CommonScriptableObjects.rendererState)
 16        {
 117            TryShowNotification();
 118        }
 19        else
 20        {
 021            if (CommonScriptableObjects.tutorialActive)
 022                CommonScriptableObjects.tutorialActive.OnChange += TutorialActiveChanged;
 23            else
 024                CommonScriptableObjects.rendererState.OnChange += RendererStateChanged;
 25
 26        }
 27
 028    }
 29
 30    private void TutorialActiveChanged(bool newState, bool oldState)
 31    {
 032        if (newState)
 033            return;
 34
 035        CommonScriptableObjects.tutorialActive.OnChange -= TutorialActiveChanged;
 036        TryShowNotification();
 037    }
 38
 39    private void RendererStateChanged(bool newState, bool oldState)
 40    {
 041        if (!newState)
 042            return;
 43
 044        CommonScriptableObjects.rendererState.OnChange -= RendererStateChanged;
 045        TryShowNotification();
 046    }
 47
 48    private void TryShowNotification()
 49    {
 150        if (GraphicCardNotification.CanShowGraphicCardPopup() && IsIntegratedGraphicCard())
 51        {
 052            NotificationsController.i.ShowNotification(new DCL.NotificationModel.Model
 53            {
 54                buttonMessage = "Dismiss",
 55                destroyOnFinish = true,
 56                groupID = "GraphicCard",
 57                message = GRAPHIC_CARD_MESSAGE,
 58                timer = 0,
 59                type = DCL.NotificationModel.Type.GRAPHIC_CARD_WARNING
 60            });
 61        }
 162    }
 63
 164    private bool IsIntegratedGraphicCard() => DCL.Interface.WebInterface.GetGraphicCard().ToLower().Contains("intel");
 65
 166    public void Dispose() { }
 67}