< Summary

Class:TopActionsButtonsController
Assembly:BuildModeHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/GodMode/TopActionsButtons/TopActionsButtonsController.cs
Covered lines:72
Uncovered lines:6
Coverable lines:78
Total lines:167
Line coverage:92.3% (72 of 78)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize(...)0%110100%
Dispose()0%110100%
ChangeModeClicked()0%220100%
ExtraClicked()0%220100%
TranslateClicked()0%220100%
RotateClicked()0%220100%
ScaleClicked()0%220100%
UndoClicked()0%220100%
RedoClicked()0%220100%
DuplicateClicked()0%220100%
DeleteClicked()0%220100%
LogoutClicked()0%220100%
SnapModeClicked()0%6200%
ConfirmLogout(...)0%3.143075%
TooltipPointerEntered(...)0%110100%
TooltipPointerExited()0%110100%
SetExtraActionsActive(...)0%2100%
SetGizmosActive(...)0%110100%
SetActionsInteractable(...)0%110100%
SetSnapActive(...)0%110100%
SetUndoInteractable(...)0%2100%
SetRedoInteractable(...)0%2100%

File(s)

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

#LineLine coverage
 1using System;
 2using UnityEngine.EventSystems;
 3
 4public interface ITopActionsButtonsController
 5{
 6    event Action OnChangeModeClick;
 7    event Action OnExtraClick;
 8    event Action OnTranslateClick;
 9    event Action OnRotateClick;
 10    event Action OnScaleClick;
 11    event Action OnUndoClick;
 12    event Action OnRedoClick;
 13    event Action OnDuplicateClick;
 14    event Action OnDeleteClick;
 15    event Action OnLogOutClick;
 16    event Action OnSnapModeClick;
 17
 18    IExtraActionsController extraActionsController { get; }
 19
 20    void Initialize(ITopActionsButtonsView topActionsButtonsView, ITooltipController tooltipController);
 21    void Dispose();
 22    void ChangeModeClicked();
 23    void ExtraClicked();
 24    void TranslateClicked();
 25    void RotateClicked();
 26    void ScaleClicked();
 27    void UndoClicked();
 28    void RedoClicked();
 29    void DuplicateClicked();
 30    void DeleteClicked();
 31    void LogoutClicked();
 32    void ConfirmLogout(BuildModeModalType modalType);
 33    void TooltipPointerEntered(BaseEventData eventData, string tooltipText);
 34    void TooltipPointerExited();
 35    void SetExtraActionsActive(bool isActive);
 36    void SetGizmosActive(string gizmos);
 37    void SetActionsInteractable(bool isActive);
 38    void SetSnapActive(bool isActive);
 39    void SetUndoInteractable(bool isActive);
 40    void SetRedoInteractable(bool isActive);
 41}
 42
 43public class TopActionsButtonsController : ITopActionsButtonsController
 44{
 45    public event Action OnChangeModeClick;
 46    public event Action OnExtraClick;
 47    public event Action OnTranslateClick;
 48    public event Action OnRotateClick;
 49    public event Action OnScaleClick;
 50    public event Action OnUndoClick;
 51    public event Action OnRedoClick;
 52    public event Action OnDuplicateClick;
 53    public event Action OnDeleteClick;
 54    public event Action OnLogOutClick;
 55    public event Action OnSnapModeClick;
 56
 057    public IExtraActionsController extraActionsController { get; private set; }
 58
 59    internal ITopActionsButtonsView topActionsButtonsView;
 60    internal ITooltipController tooltipController;
 61
 62    public void Initialize(ITopActionsButtonsView topActionsButtonsView, ITooltipController tooltipController)
 63    {
 1864        this.topActionsButtonsView = topActionsButtonsView;
 1865        this.tooltipController = tooltipController;
 66
 1867        topActionsButtonsView.OnChangeModeClicked += ChangeModeClicked;
 1868        topActionsButtonsView.OnExtraClicked += ExtraClicked;
 1869        topActionsButtonsView.OnTranslateClicked += TranslateClicked;
 1870        topActionsButtonsView.OnRotateClicked += RotateClicked;
 1871        topActionsButtonsView.OnScaleClicked += ScaleClicked;
 1872        topActionsButtonsView.OnUndoClicked += UndoClicked;
 1873        topActionsButtonsView.OnRedoClicked += RedoClicked;
 1874        topActionsButtonsView.OnDuplicateClicked += DuplicateClicked;
 1875        topActionsButtonsView.OnDeleteClicked += DeleteClicked;
 1876        topActionsButtonsView.OnLogOutClicked += LogoutClicked;
 1877        topActionsButtonsView.OnPointerExit += TooltipPointerExited;
 1878        topActionsButtonsView.OnChangeCameraModePointerEnter += TooltipPointerEntered;
 1879        topActionsButtonsView.OnTranslatePointerEnter += TooltipPointerEntered;
 1880        topActionsButtonsView.OnRotatePointerEnter += TooltipPointerEntered;
 1881        topActionsButtonsView.OnScalePointerEnter += TooltipPointerEntered;
 1882        topActionsButtonsView.OnUndoPointerEnter += TooltipPointerEntered;
 1883        topActionsButtonsView.OnRedoPointerEnter += TooltipPointerEntered;
 1884        topActionsButtonsView.OnDuplicatePointerEnter += TooltipPointerEntered;
 1885        topActionsButtonsView.OnDeletePointerEnter += TooltipPointerEntered;
 1886        topActionsButtonsView.OnMoreActionsPointerEnter += TooltipPointerEntered;
 1887        topActionsButtonsView.OnLogoutPointerEnter += TooltipPointerEntered;
 1888        topActionsButtonsView.OnSnapModePointerEnter += TooltipPointerEntered;
 1889        topActionsButtonsView.OnSnapModeClicked += SnapModeClicked;
 90
 1891        extraActionsController = new ExtraActionsController();
 1892        topActionsButtonsView.ConfigureExtraActions(extraActionsController);
 1893        extraActionsController.SetActive(false);
 1894    }
 95
 96    public void Dispose()
 97    {
 1898        topActionsButtonsView.OnChangeModeClicked -= ChangeModeClicked;
 1899        topActionsButtonsView.OnExtraClicked -= ExtraClicked;
 18100        topActionsButtonsView.OnTranslateClicked -= TranslateClicked;
 18101        topActionsButtonsView.OnRotateClicked -= RotateClicked;
 18102        topActionsButtonsView.OnScaleClicked -= ScaleClicked;
 18103        topActionsButtonsView.OnUndoClicked -= UndoClicked;
 18104        topActionsButtonsView.OnRedoClicked -= RedoClicked;
 18105        topActionsButtonsView.OnDuplicateClicked -= DuplicateClicked;
 18106        topActionsButtonsView.OnDeleteClicked -= DeleteClicked;
 18107        topActionsButtonsView.OnLogOutClicked -= LogoutClicked;
 18108        topActionsButtonsView.OnPointerExit -= TooltipPointerExited;
 18109        topActionsButtonsView.OnChangeCameraModePointerEnter -= TooltipPointerEntered;
 18110        topActionsButtonsView.OnTranslatePointerEnter -= TooltipPointerEntered;
 18111        topActionsButtonsView.OnRotatePointerEnter -= TooltipPointerEntered;
 18112        topActionsButtonsView.OnScalePointerEnter -= TooltipPointerEntered;
 18113        topActionsButtonsView.OnUndoPointerEnter -= TooltipPointerEntered;
 18114        topActionsButtonsView.OnRedoPointerEnter -= TooltipPointerEntered;
 18115        topActionsButtonsView.OnDuplicatePointerEnter -= TooltipPointerEntered;
 18116        topActionsButtonsView.OnDeletePointerEnter -= TooltipPointerEntered;
 18117        topActionsButtonsView.OnMoreActionsPointerEnter -= TooltipPointerEntered;
 18118        topActionsButtonsView.OnLogoutPointerEnter -= TooltipPointerEntered;
 18119        topActionsButtonsView.OnSnapModePointerEnter -= TooltipPointerEntered;
 18120    }
 121
 2122    public void ChangeModeClicked() { OnChangeModeClick?.Invoke(); }
 123
 2124    public void ExtraClicked() { OnExtraClick?.Invoke(); }
 125
 2126    public void TranslateClicked() { OnTranslateClick?.Invoke(); }
 127
 2128    public void RotateClicked() { OnRotateClick?.Invoke(); }
 129
 2130    public void ScaleClicked() { OnScaleClick?.Invoke(); }
 131
 2132    public void UndoClicked() { OnUndoClick?.Invoke(); }
 133
 2134    public void RedoClicked() { OnRedoClick?.Invoke(); }
 135
 2136    public void DuplicateClicked() { OnDuplicateClick?.Invoke(); }
 137
 2138    public void DeleteClicked() { OnDeleteClick?.Invoke(); }
 139
 2140    public void LogoutClicked() { OnLogOutClick?.Invoke(); }
 141
 0142    public void SnapModeClicked() { OnSnapModeClick?.Invoke(); }
 143
 144    public void ConfirmLogout(BuildModeModalType modalType)
 145    {
 1146        if (modalType != BuildModeModalType.EXIT)
 0147            return;
 148
 1149        OnLogOutClick?.Invoke();
 1150    }
 151
 152    public void TooltipPointerEntered(BaseEventData eventData, string tooltipText)
 153    {
 1154        tooltipController.ShowTooltip(eventData);
 1155        tooltipController.SetTooltipText(tooltipText);
 1156    }
 157
 2158    public void TooltipPointerExited() { tooltipController.HideTooltip(); }
 159
 0160    public void SetExtraActionsActive(bool isActive) { extraActionsController.SetActive(isActive); }
 2161    public void SetGizmosActive(string gizmos) { topActionsButtonsView.SetGizmosActive(gizmos); }
 4162    public void SetActionsInteractable(bool isActive) { topActionsButtonsView.SetActionsInteractable(isActive); }
 4163    public void SetSnapActive(bool isActive) { topActionsButtonsView.SetSnapActive(isActive); }
 0164    public void SetUndoInteractable(bool isActive) { topActionsButtonsView.SetUndoInteractable(isActive); }
 165
 0166    public void SetRedoInteractable(bool isActive) { topActionsButtonsView.SetRedoInteractable(isActive); }
 167}