< Summary

Class:DCL.Chat.HUD.ChannelEntryFactory
Assembly:WorldChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/ChannelEntryFactory.cs
Covered lines:2
Uncovered lines:0
Coverable lines:2
Total lines:29
Line coverage:100% (2 of 2)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Create(...)0%660100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/ChannelEntryFactory.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using UnityEngine;
 5
 6namespace DCL.Chat.HUD
 7{
 8    [CreateAssetMenu(fileName = "ChannelEntryFactory", menuName = "DCL/Social/ChannelEntryFactory")]
 9    public class ChannelEntryFactory : ScriptableObject
 10    {
 11        [Serializable]
 12        private struct SpecialEntry
 13        {
 14            public string channelId;
 15            public PublicChatEntry prefab;
 16        }
 17
 18        [SerializeField] private PublicChatEntry defaultEntryPrefab;
 19        [SerializeField] private SpecialEntry[] specialEntryPrefabs;
 20
 21        private Dictionary<string, PublicChatEntry> specialEntries;
 22
 23        public PublicChatEntry Create(string channelId)
 24        {
 3825            specialEntries ??= specialEntryPrefabs.ToDictionary(entry => entry.channelId, entry => entry.prefab);
 3226            return Instantiate(specialEntries.ContainsKey(channelId) ? specialEntries[channelId] : defaultEntryPrefab);
 27        }
 28    }
 29}

Methods/Properties

Create(System.String)