< Summary

Class:ExpressionsHUDController
Assembly:ExpressionsHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/ExpressionsHUD/ExpressionsHUDController.cs
Covered lines:19
Uncovered lines:3
Coverable lines:22
Total lines:54
Line coverage:86.3% (19 of 22)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ExpressionsHUDController()0%110100%
SetVisibility(...)0%2.152066.67%
Dispose()0%220100%
ExpressionCalled(...)0%110100%
OnAvatarExpressionSet(...)0%2.152066.67%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/ExpressionsHUD/ExpressionsHUDController.cs

#LineLine coverage
 1using System;
 2using DCL;
 3using UnityEngine;
 4
 5public class ExpressionsHUDController : IHUD
 6{
 7    internal ExpressionsHUDView view;
 8
 229    private UserProfile ownUserProfile => UserProfile.GetOwnUserProfile();
 10
 711    public ExpressionsHUDController()
 12    {
 713        view = ExpressionsHUDView.Create();
 714        view.Initialize(ExpressionCalled);
 15
 716        ownUserProfile.OnAvatarExpressionSet += OnAvatarExpressionSet;
 717    }
 18
 19    public void SetVisibility(bool visible)
 20    {
 121        view.SetVisiblity(visible);
 22
 123        if ( visible )
 24        {
 125            ownUserProfile.snapshotObserver.AddListener(view.UpdateAvatarSprite);
 126        }
 27        else
 28        {
 029            ownUserProfile.snapshotObserver.RemoveListener(view.UpdateAvatarSprite);
 30        }
 031    }
 32
 33    public void Dispose()
 34    {
 735        ownUserProfile.snapshotObserver.RemoveListener(view.UpdateAvatarSprite);
 736        ownUserProfile.OnAvatarExpressionSet -= OnAvatarExpressionSet;
 37
 738        if (view != null)
 39        {
 740            view.CleanUp();
 741            UnityEngine.Object.Destroy(view.gameObject);
 42        }
 743    }
 44
 445    public void ExpressionCalled(string id) { UserProfile.GetOwnUserProfile().SetAvatarExpression(id); }
 46
 47    private void OnAvatarExpressionSet(string id, long timestamp)
 48    {
 249        if (view.IsContentVisible())
 50        {
 051            view.HideContent();
 52        }
 253    }
 54}