< Summary

Class:DCL.CursorLockHint
Assembly:MouseCatcher
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/MouseCatcher/CursorLockHint.cs
Covered lines:4
Uncovered lines:8
Coverable lines:12
Total lines:38
Line coverage:33.3% (4 of 12)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Start()0%110100%
OnDestroy()0%110100%
HandleCursorLockChanges(...)0%30500%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/MouseCatcher/CursorLockHint.cs

#LineLine coverage
 1using DCL.Helpers;
 2using UnityEngine;
 3
 4namespace DCL
 5{
 6    public class CursorLockHint : MonoBehaviour
 7    {
 8        private bool hasBeenShown;
 9
 10        [SerializeField] private ShowHideAnimator toastRoot;
 11        [SerializeField] private float duration;
 12
 13        private void Start()
 14        {
 315            Utils.OnCursorLockChanged += HandleCursorLockChanges;
 316        }
 17
 18        private void OnDestroy()
 19        {
 320            Utils.OnCursorLockChanged -= HandleCursorLockChanges;
 321        }
 22
 23        private void HandleCursorLockChanges(bool isLocked)
 24        {
 025            if (!isLocked)
 26            {
 027                toastRoot.Hide();
 028                return;
 29            }
 30
 031            if (DataStore.i.camera.panning.Get() || hasBeenShown || toastRoot.isVisible)
 032                return;
 33
 034            hasBeenShown = true;
 035            toastRoot.ShowDelayHide(duration);
 036        }
 37    }
 38}