< Summary

Class:GotoPanel.GotoPanelHUDController
Assembly:GotoHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/GotoPanelHUD/GotoPanelHUDController.cs
Covered lines:13
Uncovered lines:14
Coverable lines:27
Total lines:61
Line coverage:48.1% (13 of 27)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CreateView()0%2100%
Initialize()0%110100%
ChangeVisibility(...)0%110100%
SetCoordinates(...)0%2.062075%
Dispose()0%6200%
SetVisibility(...)0%110100%
Teleport(...)0%2100%
ClosePanel()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/GotoPanelHUD/GotoPanelHUDController.cs

#LineLine coverage
 1using DCL;
 2using DCL.Interface;
 3using UnityEngine;
 4
 5namespace GotoPanel
 6{
 7    public class GotoPanelHUDController
 8    {
 09        internal IGotoPanelHUDView view { get; private set; }
 10
 011        internal virtual IGotoPanelHUDView CreateView() => GotoPanelHUDView.CreateView();
 12
 13        public void Initialize()
 14        {
 415            view = CreateView();
 416            view.OnTeleportPressed += Teleport;
 417            view.OnClosePressed += ClosePanel;
 418            DataStore.i.HUDs.gotoPanelVisible.OnChange += ChangeVisibility;
 419            DataStore.i.HUDs.gotoPanelCoordinates.OnChange += SetCoordinates;
 420        }
 21
 22        private void ChangeVisibility(bool current, bool previous)
 23        {
 224            SetVisibility(current);
 225        }
 26
 27        private void SetCoordinates(ParcelCoordinates current, ParcelCoordinates previous)
 28        {
 129            if (current == previous)
 030                return;
 31
 132            view.SetPanelInfo(current);
 133        }
 34
 35        public void Dispose()
 36        {
 037            view.OnTeleportPressed -= Teleport;
 038            view.OnClosePressed -= ClosePanel;
 039            DataStore.i.HUDs.gotoPanelVisible.OnChange -= ChangeVisibility;
 040            DataStore.i.HUDs.gotoPanelCoordinates.OnChange -= SetCoordinates;
 041            view?.Dispose();
 042        }
 43
 44        public void SetVisibility(bool visible)
 45        {
 246            view.SetVisible(visible);
 247        }
 48
 49        public void Teleport(ParcelCoordinates parcelCoordinates)
 50        {
 051            WebInterface.GoTo(parcelCoordinates.x, parcelCoordinates.y);
 052        }
 53
 54        public void ClosePanel()
 55        {
 056            DataStore.i.HUDs.gotoPanelVisible.Set(false);
 057            AudioScriptableObjects.dialogClose.Play(true);
 058        }
 59
 60    }
 61}