< 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:1
Coverable lines:20
Total lines:42
Line coverage:95% (19 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ExpressionsHUDController()0%110100%
SetVisibility(...)0%110100%
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;
 2
 3public class ExpressionsHUDController : IHUD
 4{
 5    internal ExpressionsHUDView view;
 356    private UserProfile ownUserProfile => UserProfile.GetOwnUserProfile();
 7    private Action<UserProfile> userProfileUpdateDelegate;
 8
 79    public ExpressionsHUDController()
 10    {
 711        view = ExpressionsHUDView.Create();
 712        view.Initialize(ExpressionCalled);
 1613        userProfileUpdateDelegate = profile => view.UpdateAvatarSprite(profile.faceSnapshot);
 714        userProfileUpdateDelegate.Invoke(ownUserProfile);
 715        ownUserProfile.OnUpdate += userProfileUpdateDelegate;
 716        ownUserProfile.OnAvatarExpressionSet += OnAvatarExpressionSet;
 717    }
 18
 219    public void SetVisibility(bool visible) { view.SetVisiblity(visible); }
 20
 21    public void Dispose()
 22    {
 723        ownUserProfile.OnUpdate -= userProfileUpdateDelegate;
 724        ownUserProfile.OnAvatarExpressionSet -= OnAvatarExpressionSet;
 25
 726        if (view != null)
 27        {
 728            view.CleanUp();
 729            UnityEngine.Object.Destroy(view.gameObject);
 30        }
 731    }
 32
 433    public void ExpressionCalled(string id) { UserProfile.GetOwnUserProfile().SetAvatarExpression(id); }
 34
 35    private void OnAvatarExpressionSet(string id, long timestamp)
 36    {
 237        if (view.IsContentVisible())
 38        {
 039            view.HideContent();
 40        }
 241    }
 42}