< Summary

Class:DCL.Social.Passports.PassportPlayerPreviewComponentView
Assembly:PassportHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Passport/Passport/PlayerPreview/PassportPlayerPreviewComponentView.cs
Covered lines:0
Uncovered lines:24
Coverable lines:24
Total lines:80
Line coverage:0% (0 of 24)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:11
Method coverage:0% (0 of 11)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PassportPlayerPreviewComponentView()0%2100%
Initialize(...)0%2100%
Dispose()0%2100%
HideTutorial()0%2100%
SetAsLoading(...)0%2100%
RefreshControl()0%6200%
EndPreviewDrag(...)0%6200%
get_CharacterPreviewTexture()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Passport/Passport/PlayerPreview/PassportPlayerPreviewComponentView.cs

#LineLine coverage
 1using MainScripts.DCL.Controllers.HUD.CharacterPreview;
 2using System;
 3using UIComponents.Scripts.Components;
 4using UnityEngine;
 5using UnityEngine.UI;
 6
 7namespace DCL.Social.Passports
 8{
 9    public class PassportPlayerPreviewComponentView : BaseComponentView<PassportPlayerPreviewModel>, IPassportPlayerPrev
 10    {
 11        [field: SerializeField]
 012        public RawImage CharacterPreviewImage { get; private set; }
 13        public event Action<double> OnEndDragEvent;
 14
 015        public PreviewCameraRotationController PreviewCameraRotationController => (PreviewCameraRotationController) avat
 16        private IPreviewCameraRotationController avatarPreviewRotationController;
 17
 18        [SerializeField] private ShowHideAnimator tutorialShowHide;
 19        [SerializeField] private GameObject loadingSpinner;
 20
 21        [Header("MOUSE INPUT CONFIGURATION")]
 22        [SerializeField] private CharacterPreviewInputDetector characterPreviewInputDetector;
 23        [SerializeField] private InputAction_Hold firstClickAction;
 24
 25        [Header("ROTATE CONFIGURATION")]
 026        [SerializeField] private float rotationFactor = -30f;
 027        [SerializeField] private float slowDownTime = 0.5f;
 28
 29        public void Initialize(IPreviewCameraRotationController avatarPreviewRotationController)
 30        {
 031            this.avatarPreviewRotationController = avatarPreviewRotationController;
 032            this.avatarPreviewRotationController.Configure(
 33                firstClickAction,
 34                rotationFactor,
 35                slowDownTime,
 36                characterPreviewInputDetector,
 37                null);
 38
 039            this.avatarPreviewRotationController.OnEndDragEvent += EndPreviewDrag;
 040        }
 41
 42        public override void Dispose()
 43        {
 044            base.Dispose();
 45
 046            avatarPreviewRotationController.OnEndDragEvent -= EndPreviewDrag;
 047            avatarPreviewRotationController.Dispose();
 048        }
 49
 50        public void HideTutorial()
 51        {
 052            tutorialShowHide.Hide();
 053        }
 54
 55        public void SetAsLoading(bool isLoading)
 56        {
 057            loadingSpinner.SetActive(isLoading);
 058            CharacterPreviewImage.gameObject.SetActive(!isLoading);
 059        }
 60
 61        public override void RefreshControl()
 62        {
 063            if (model.TutorialEnabled)
 64            {
 065                tutorialShowHide.gameObject.SetActive(true);
 66            }
 67            else
 68            {
 069                HideTutorial();
 70            }
 071        }
 72
 73        private void EndPreviewDrag(double dragTime)
 74        {
 075            OnEndDragEvent?.Invoke(dragTime);
 076        }
 77
 078        RenderTexture IPassportPlayerPreviewComponentView.CharacterPreviewTexture => (RenderTexture) CharacterPreviewIma
 79    }
 80}