< Summary

Class:UserContextConfirmationDialog
Assembly:UserContextMenu
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/UserContextMenu/Scripts/UserContextConfirmationDialog.cs
Covered lines:15
Uncovered lines:0
Coverable lines:15
Total lines:35
Line coverage:100% (15 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
SetText(...)0%110100%
Show(...)0%110100%
Hide()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/UserContextMenu/Scripts/UserContextConfirmationDialog.cs

#LineLine coverage
 1using TMPro;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5public class UserContextConfirmationDialog : MonoBehaviour, IConfirmationDialog
 6{
 7    public TextMeshProUGUI dialogText;
 8    public Button cancelButton;
 9    public Button confirmButton;
 10
 111    public void Awake() { }
 12
 1413    public void SetText(string text) { dialogText.text = text; }
 14
 15    public void Show(System.Action onConfirm = null, System.Action onCancel = null)
 16    {
 717        confirmButton.onClick.RemoveAllListeners();
 718        confirmButton.onClick.AddListener(() =>
 19        {
 320            onConfirm?.Invoke();
 321            Hide();
 322        });
 23
 724        cancelButton.onClick.RemoveAllListeners();
 725        cancelButton.onClick.AddListener(() =>
 26        {
 227            onCancel?.Invoke();
 228            Hide();
 229        });
 30
 731        gameObject.SetActive(true);
 732    }
 33
 6634    public void Hide() { gameObject.SetActive(false); }
 35}