< Summary

Class:DCL.Huds.QuestsPanel.QuestsPanelTask_Numeric
Assembly:QuestsPanelHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/QuestsPanelHUD/QuestsPanelTask_Numeric.cs
Covered lines:10
Uncovered lines:3
Coverable lines:13
Total lines:47
Line coverage:76.9% (10 of 13)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
Populate(...)0%440100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/QuestsPanelHUD/QuestsPanelTask_Numeric.cs

#LineLine coverage
 1using DCL.Interface;
 2using System;
 3using TMPro;
 4using UnityEngine;
 5using UnityEngine.UI;
 6
 7namespace DCL.Huds.QuestsPanel
 8{
 9    public class QuestsPanelTask_Numeric : MonoBehaviour, IQuestsPanelTask
 10    {
 11        [SerializeField] internal TextMeshProUGUI taskName;
 12        [SerializeField] internal TextMeshProUGUI progressText;
 13        [SerializeField] internal Image ongoingProgress;
 14        [SerializeField] internal Button jumpInButton;
 15        [SerializeField] internal Toggle status;
 16        [SerializeField] internal Color ongoinColor;
 17        [SerializeField] internal Color completedcolor;
 18
 19        internal TaskPayload_Numeric payload;
 20        private Action jumpInDelegate;
 21
 422        public void Awake() { jumpInButton.onClick.AddListener(() => { jumpInDelegate?.Invoke(); }); }
 23
 24        public void Populate( QuestModel quest, QuestTask task)
 25        {
 226            payload = JsonUtility.FromJson<TaskPayload_Numeric>(task.payload);
 27
 228            jumpInButton.gameObject.SetActive(task.progress < 1 && !string.IsNullOrEmpty(task.coordinates));
 229            jumpInDelegate = () =>
 30            {
 031                QuestsUIAnalytics.SendJumpInPressed(quest.id, task.id, task.coordinates, QuestsUIAnalytics.UIContext.Que
 032                WebInterface.SendChatMessage(new ChatMessage
 33                {
 34                    messageType = ChatMessage.Type.NONE,
 35                    recipient = string.Empty,
 36                    body = $"/goto {task.coordinates}",
 37                });
 038            };
 39
 240            taskName.text = task.name;
 241            progressText.text = $"{payload.current}/{payload.end}";
 242            status.isOn = task.progress >= 1;
 243            ongoingProgress.transform.localScale = new Vector3(task.progress, 1, 1);
 244            ongoingProgress.color = task.progress < 1 ? ongoinColor : completedcolor;
 245        }
 46    }
 47}