< Summary

Class:TooltipView
Assembly:BuildModeHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/Common/TooltipView.cs
Covered lines:7
Uncovered lines:2
Coverable lines:9
Total lines:44
Line coverage:77.7% (7 of 9)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
TooltipView()0%110100%
Create()0%110100%
SetTooltipPosition(...)0%110100%
SetText(...)0%110100%
SetTooltipAlpha(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/Common/TooltipView.cs

#LineLine coverage
 1using System;
 2using TMPro;
 3using UnityEngine;
 4using UnityEngine.EventSystems;
 5
 6public interface ITooltipView
 7{
 8    float alphaTranstionSpeed { get; }
 9    float currentAlpha { get; }
 10
 11    event Action OnHideTooltip;
 12    void SetText(string text);
 13    void SetTooltipPosition(Vector3 pos);
 14    void SetTooltipAlpha(float alphaValue);
 15}
 16
 17public class TooltipView : MonoBehaviour, ITooltipView
 18{
 019    public float alphaTranstionSpeed => alphaSpeed;
 020    public float currentAlpha => tooltipCG.alpha;
 21
 22    public event Action OnHideTooltip;
 23
 4424    [SerializeField] internal float alphaSpeed = 3f;
 25    [SerializeField] internal RectTransform tooltipRT;
 26    [SerializeField] internal CanvasGroup tooltipCG;
 27    [SerializeField] internal TextMeshProUGUI tooltipTxt;
 28
 29    private const string VIEW_PATH = "Common/ToolTipView";
 30
 31    internal static TooltipView Create()
 32    {
 333        var view = Instantiate(Resources.Load<GameObject>(VIEW_PATH)).GetComponent<TooltipView>();
 334        view.gameObject.name = "_TooltipView";
 35
 336        return view;
 37    }
 38
 239    public void SetTooltipPosition(Vector3 pos) { tooltipRT.position = pos; }
 40
 241    public void SetText(string text) { tooltipTxt.text = text; }
 42
 243    public void SetTooltipAlpha(float alphaValue) { tooltipCG.alpha = alphaValue; }
 44}