< Summary

Class:ActionsListView
Assembly:BuilderInWorldEntityInformation
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/BuilderMode/EntityInformation/SmartItems/Parameters/Actions/ActionsListView.cs
Covered lines:0
Uncovered lines:20
Coverable lines:20
Total lines:50
Line coverage:0% (0 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AddAdapters()0%6200%
RemoveAdapters()0%6200%
RemoveAdapter(...)0%2100%
AddActionEventAdapter(...)0%2100%
RemoveActionable(...)0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/BuilderMode/EntityInformation/SmartItems/Parameters/Actions/ActionsListView.cs

#LineLine coverage
 1using DCL.Components;
 2using System.Collections;
 3using System.Collections.Generic;
 4using UnityEngine;
 5
 6public class ActionsListView : ListView<SmartItemActionEvent>
 7{
 8    public SmartItemActionEventAdapter adapter;
 9    public System.Action<SmartItemActionable> OnActionableRemove;
 10
 11    public override void AddAdapters()
 12    {
 013        base.AddAdapters();
 14
 015        foreach (SmartItemActionEvent actionEvent in contentList)
 16        {
 017            SmartItemActionEventAdapter adapter = Instantiate(this.adapter, contentPanelTransform).GetComponent<SmartIte
 018            adapter.OnActionableRemove += RemoveActionable;
 019            adapter.SetContent(actionEvent);
 20        }
 021    }
 22
 23    public override void RemoveAdapters()
 24    {
 025        for (int i = 0; i < contentPanelTransform.transform.childCount; i++)
 26        {
 027            SmartItemActionEventAdapter toRemove = contentPanelTransform.transform.GetChild(i).gameObject.GetComponent<S
 028            RemoveAdapter(toRemove);
 29        }
 030    }
 31
 32    private void RemoveAdapter(SmartItemActionEventAdapter adapter)
 33    {
 034        adapter.OnActionableRemove -= RemoveActionable;
 035        Destroy(adapter.gameObject);
 036    }
 37
 38    public void AddActionEventAdapter(SmartItemActionEvent actionEvent)
 39    {
 040        contentList.Add(actionEvent);
 041        RefreshDisplay();
 042    }
 43
 44    private void RemoveActionable(SmartItemActionEventAdapter actionable)
 45    {
 046        contentList.Remove(actionable.GetContent());
 047        OnActionableRemove?.Invoke(actionable.GetContent().smartItemActionable);
 048        RemoveAdapter(actionable);
 049    }
 50}