< Summary

Class:PubllishLandListAdapter
Assembly:BuilderPublisher
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Publisher/ProjectPublishHUD/Scripts/Projects/PubllishLandListAdapter.cs
Covered lines:0
Uncovered lines:15
Coverable lines:15
Total lines:52
Line coverage:0% (0 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetState()0%2100%
GetLand()0%2100%
Awake()0%2100%
OnDestroy()0%2100%
SetContent(...)0%6200%
SetState(...)0%2100%
ItemSelected()0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Publisher/ProjectPublishHUD/Scripts/Projects/PubllishLandListAdapter.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using TMPro;
 5using UnityEngine;
 6using UnityEngine.UI;
 7
 8public class PubllishLandListAdapter : MonoBehaviour
 9{
 10    public enum AdapterState
 11    {
 12        ENABLE = 0,
 13        DISABLE = 1
 14    }
 15
 16    public event Action<LandWithAccess> OnLandSelected;
 17
 18    [SerializeField] internal TextMeshProUGUI landNameTxt;
 19
 20    [SerializeField] internal Button selectButton;
 21
 22    internal LandWithAccess land;
 23    internal AdapterState currentState;
 24
 025    public AdapterState GetState() => currentState;
 026    public LandWithAccess GetLand() => land;
 27
 028    private void Awake() { selectButton.onClick.AddListener(ItemSelected); }
 29
 030    private void OnDestroy() { selectButton.onClick.RemoveAllListeners(); }
 31
 32    public void SetContent(LandWithAccess land, AdapterState state)
 33    {
 034        this.land = land;
 35
 036        string text = land.name;
 037        string coordsText = BIWUtils.Vector2INTToString(land.baseCoords);
 038        if(!text.Contains(coordsText))
 039            text += " <color=#716B7C>"+coordsText+"</color>";
 40
 041        landNameTxt.text = text;
 42
 043        SetState(state);
 044    }
 45
 46    public void SetState(AdapterState state)
 47    {
 048        currentState = state;
 049    }
 50
 051    public void ItemSelected() { OnLandSelected?.Invoke(land); }
 52}