< Summary

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

Metrics

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

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
 011    public void Awake() { }
 12
 013    public void SetText(string text) { dialogText.text = text; }
 14
 15    public void Show(System.Action onConfirm = null, System.Action onCancel = null)
 16    {
 017        confirmButton.onClick.RemoveAllListeners();
 018        confirmButton.onClick.AddListener(() =>
 19        {
 020            onConfirm?.Invoke();
 021            Hide();
 022        });
 23
 024        cancelButton.onClick.RemoveAllListeners();
 025        cancelButton.onClick.AddListener(() =>
 26        {
 027            onCancel?.Invoke();
 028            Hide();
 029        });
 30
 031        gameObject.SetActive(true);
 032    }
 33
 034    public void Hide() { gameObject.SetActive(false); }
 35}