< Summary

Class:PublishBtnController
Assembly:BuildModeHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/GodMode/PublishBtnController.cs
Covered lines:20
Uncovered lines:5
Coverable lines:25
Total lines:69
Line coverage:80% (20 of 25)
Covered branches:0
Total branches:0

Metrics

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

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/GodMode/PublishBtnController.cs

#LineLine coverage
 1using System;
 2using UnityEngine.EventSystems;
 3
 4public interface IPublishBtnController
 5{
 6    event Action OnClick;
 7
 8    void Initialize(IPublishBtnView publishBtnView, ITooltipController tooltipController, ITooltipController feedbackToo
 9    void Dispose();
 10    void Click();
 11    void ShowTooltip(BaseEventData eventData, string tooltipText);
 12    void HideTooltip();
 13    void SetFeedbackMessage(string newText);
 14    void SetInteractable(bool isInteractable);
 15}
 16
 17public class PublishBtnController : IPublishBtnController
 18{
 19    public event Action OnClick;
 20
 21    internal IPublishBtnView publishBtnView;
 22    internal ITooltipController tooltipController;
 23    internal ITooltipController feedbackTooltipController;
 024    internal string currentFeedbackmessage = string.Empty;
 25
 26    public void Initialize(IPublishBtnView publishBtnView, ITooltipController tooltipController, ITooltipController feed
 27    {
 628        this.publishBtnView = publishBtnView;
 629        this.tooltipController = tooltipController;
 630        this.feedbackTooltipController = feedbackTooltipController;
 31
 632        publishBtnView.OnPublishButtonClick += Click;
 633        publishBtnView.OnShowTooltip += ShowTooltip;
 634        publishBtnView.OnHideTooltip += HideTooltip;
 635    }
 36
 37    public void Dispose()
 38    {
 639        publishBtnView.OnPublishButtonClick -= Click;
 640        publishBtnView.OnShowTooltip -= ShowTooltip;
 641        publishBtnView.OnHideTooltip -= HideTooltip;
 642    }
 43
 244    public void Click() { OnClick?.Invoke(); }
 45
 46    public void ShowTooltip(BaseEventData eventData, string tooltipText)
 47    {
 148        if (string.IsNullOrEmpty(currentFeedbackmessage))
 49        {
 150            tooltipController.SetTooltipText(tooltipText);
 151            tooltipController.ShowTooltip(eventData);
 152        }
 53        else
 54        {
 055            feedbackTooltipController.SetTooltipText(currentFeedbackmessage);
 056            feedbackTooltipController.ShowTooltip(eventData);
 57        }
 058    }
 59
 60    public void HideTooltip()
 61    {
 162        tooltipController.HideTooltip();
 163        feedbackTooltipController.HideTooltip();
 164    }
 65
 066    public void SetFeedbackMessage(string newText) { currentFeedbackmessage = newText; }
 67
 468    public void SetInteractable(bool isInteractable) { publishBtnView.SetInteractable(isInteractable); }
 69}