< Summary

Class:FirstPersonModeController
Assembly:BuildModeHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/FirstPersonMode/FirstPersonModeController.cs
Covered lines:15
Uncovered lines:0
Coverable lines:15
Total lines:48
Line coverage:100% (15 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize(...)0%110100%
Dispose()0%110100%
Click()0%220100%
ShowTooltip(...)0%110100%
HideTooltip()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/FirstPersonMode/FirstPersonModeController.cs

#LineLine coverage
 1using System;
 2using UnityEngine.EventSystems;
 3
 4public interface IFirstPersonModeController
 5{
 6    event Action OnClick;
 7
 8    void Initialize(IFirstPersonModeView firstPersonModeView, ITooltipController tooltipController);
 9    void Dispose();
 10    void Click();
 11    void ShowTooltip(BaseEventData eventData, string tooltipText);
 12    void HideTooltip();
 13}
 14
 15public class FirstPersonModeController : IFirstPersonModeController
 16{
 17    public event Action OnClick;
 18
 19    internal IFirstPersonModeView firstPersonModeView;
 20    internal ITooltipController tooltipController;
 21
 22    public void Initialize(IFirstPersonModeView firstPersonModeView, ITooltipController tooltipController)
 23    {
 324        this.firstPersonModeView = firstPersonModeView;
 325        this.tooltipController = tooltipController;
 26
 327        firstPersonModeView.OnFirstPersonModeClick += Click;
 328        firstPersonModeView.OnShowTooltip += ShowTooltip;
 329        firstPersonModeView.OnHideTooltip += HideTooltip;
 330    }
 31
 32    public void Dispose()
 33    {
 334        firstPersonModeView.OnFirstPersonModeClick -= Click;
 335        firstPersonModeView.OnShowTooltip -= ShowTooltip;
 336        firstPersonModeView.OnHideTooltip -= HideTooltip;
 337    }
 38
 239    public void Click() { OnClick?.Invoke(); }
 40
 41    public void ShowTooltip(BaseEventData eventData, string tooltipText)
 42    {
 143        tooltipController.ShowTooltip(eventData);
 144        tooltipController.SetTooltipText(tooltipText);
 145    }
 46
 247    public void HideTooltip() { tooltipController.HideTooltip(); }
 48}