< Summary

Class:DCL.Social.Passports.PassportNavigationComponentView
Assembly:PassportHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Passport/Passport/PassportNavigation/PassportNavigationComponentView.cs
Covered lines:6
Uncovered lines:256
Coverable lines:262
Total lines:611
Line coverage:2.2% (6 of 262)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PassportNavigationComponentView()0%110100%
PassportNavigationComponentView()0%110100%
Start()0%2100%
EnableAboutSection(...)0%2100%
EnableCollectiblesSection(...)0%6200%
InitializeView()0%2100%
SetGuestUser(...)0%2100%
SetName(...)0%2100%
SetOwnUserTexts(...)0%12300%
SetDescription(...)0%20400%
SetLinks(...)0%20400%
ClickedLink(...)0%6200%
SetEquippedWearables(...)0%12300%
SetCollectibleWearables(...)0%6200%
SetCollectibleEmotes(...)0%6200%
SetCollectibleNames(...)0%6200%
SetCollectibleLands(...)0%6200%
SetHasBlockedOwnUser(...)0%2100%
SetInitialPage()0%2100%
CloseAllNFTItemInfos()0%20400%
ClickOnBuyWearable(...)0%6200%
FocusEquippedNftItem(...)0%6200%
FocusAnyNtfItem()0%2100%
CleanEquippedWearables()0%6200%
CleanWearables()0%6200%
GetNftIconEntryPool()0%6200%
GetNftPagesEntryPool()0%6200%
RefreshControl()0%2100%
SetCollectibleWearablesLoadingActive(...)0%2100%
SetCollectibleEmotesLoadingActive(...)0%2100%
SetCollectibleNamesLoadingActive(...)0%2100%
SetCollectibleLandsLoadingActive(...)0%2100%
SetCollectibleSectionLoadingActive(...)0%6200%
CreateNamePageView(...)0%2100%
CreateNamePageElements(...)0%20400%
CreateWearablePageView(...)0%20400%
CreateEmotePageView(...)0%20400%
CreateLandPageView(...)0%30500%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Passport/Passport/PassportNavigation/PassportNavigationComponentView.cs

#LineLine coverage
 1using DCLServices.Lambdas.LandsService;
 2using DCLServices.Lambdas.NamesService;
 3using System;
 4using System.Collections.Generic;
 5using System.Linq;
 6using System.Text.RegularExpressions;
 7using TMPro;
 8using UnityEngine;
 9using UnityEngine.UI;
 10
 11namespace DCL.Social.Passports
 12{
 13    public class PassportNavigationComponentView : BaseComponentView, IPassportNavigationComponentView
 14    {
 15        private const string GUEST_TEXT = "is a guest";
 16        private const string BLOCKED_TEXT = "blocked you!";
 17        private const string LINKS_REGEX = @"\[(.*?)\)";
 18        private const string LINK_TITLE_REGEX = @"(?<=\[).+?(?=\])";
 19        private const string LINK_REGEX = @"(?<=\().+?(?=\))";
 20        private const string OWN_PLAYER = "\n         You don't ";
 21        private const string OTHER_PLAYERS = "\n         This person doesn't ";
 22        private const string NO_WEARABLES_TEXT = "own any Wearables yet.";
 23        private const string NO_EMOTES_TEXT = "own any Emotes yet.";
 24        private const string NO_NAMES_TEXT = "own any NAMEs yet.";
 25        private const string NO_LANDS_TEXT = "own any LANDs yet.";
 26        private const string NAME_TYPE = "name";
 27        private const string EMOTE_TYPE = "emote";
 28        private const string LEGENDARY_RARITY = "legendary";
 29        private const string LAND_RARITY = "land";
 30        private const int PAGE_SIZE = 4;
 31
 32        [SerializeField] private GameObject aboutPanel;
 33        [SerializeField] private GameObject wearablesPanel;
 34        [SerializeField] private Toggle aboutToggle;
 35        [SerializeField] private Toggle collectiblesToggle;
 36        [SerializeField] private GameObject guestPanel;
 37        [SerializeField] private GameObject normalPanel;
 38        [SerializeField] private GameObject hasBlockedPanel;
 39        [SerializeField] private Transform equippedWearablesContainer;
 40        [SerializeField] private TextMeshProUGUI usernameText;
 41        [SerializeField] private TextMeshProUGUI blockedUsernameText;
 42        [SerializeField] private TextMeshProUGUI descriptionText;
 43        [SerializeField] private GameObject emptyDescriptionGO;
 44        [SerializeField] private CarouselComponentView nftWearablesCarousel;
 45        [SerializeField] private TMP_Text emptyWearablesText;
 46        [SerializeField] private GameObject nftWearablesLoadingSpinner;
 47        [SerializeField] private CarouselComponentView nftEmotesCarousel;
 48        [SerializeField] private TMP_Text emptyEmotesText;
 49        [SerializeField] private GameObject nftEmotesLoadingSpinner;
 50        [SerializeField] private CarouselComponentView nftNamesCarousel;
 51        [SerializeField] private TMP_Text emptyNamesText;
 52        [SerializeField] private GameObject nftNamesLoadingSpinner;
 53        [SerializeField] private CarouselComponentView nftLandsCarousel;
 54        [SerializeField] private TMP_Text emptyLandsText;
 55        [SerializeField] private GameObject nftLandsLoadingSpinner;
 56        [SerializeField] private Transform nftWearablesCarouselContent;
 57        [SerializeField] private Transform nftEmotesCarouselContent;
 58        [SerializeField] private Transform nftNamesCarouselContent;
 59        [SerializeField] private Transform nftLandsCarouselContent;
 60        [SerializeField] private GameObject wearableUIReferenceObject;
 61        [SerializeField] private GameObject nftPageUIReferenceObject;
 62        [SerializeField] private GameObject linksContainer;
 63        [SerializeField] private GameObject linksTitle;
 64        [SerializeField] private GameObject linkPrefabReference;
 65        [SerializeField] private GameObject aboutToggleOn;
 66        [SerializeField] private GameObject aboutToggleOff;
 67        [SerializeField] private GameObject collectiblesToggleOn;
 68        [SerializeField] private GameObject collectiblesToggleOff;
 69        [SerializeField] private TMP_Text aboutText;
 70        [SerializeField] private TMP_Text collectiblesText;
 71        [SerializeField] private OpenUrlView openUrlView;
 72        [SerializeField] internal NFTItemInfo nftItemInfo;
 73        [SerializeField] internal ScrollRect nftWearablesScrollRect;
 74        [SerializeField] internal ScrollRect nftEmotesScrollRect;
 75        [SerializeField] internal ScrollRect nftNamesScrollRect;
 76        [SerializeField] internal ScrollRect nftLandsScrollRect;
 77        [SerializeField] internal ScrollRect collectiblesMainScrollRect;
 78
 179        private static readonly Vector3 NFT_ICON_SCALE = new Vector3(0.75f, 0.75f, 0.75f);
 80        public event Action<string, string> OnClickBuyNft;
 81        public event Action OnClickedLink;
 82        public event Action OnClickCollectibles;
 83
 84        private const string NFT_ICON_POOL_NAME_PREFIX = "NFTIconsEntriesPool_";
 85        private const string NFT_PAGES_POOL_NAME_PREFIX = "NFTPagesEntriesPool_";
 86        private const int MAX_NFT_ICON_ENTRIES = 20;
 87        private const int MAX_NFT_PAGES_ENTRIES = 20;
 88
 189        private List<PoolableObject> nftIconPoolableQueue = new List<PoolableObject>();
 190        private List<PoolableObject> nftPagesPoolableQueue = new List<PoolableObject>();
 91        private Pool nftIconsEntryPool;
 92        private Pool nftPagesEntryPool;
 193        private readonly List<NFTIconComponentView> equippedNftWearableViews = new List<NFTIconComponentView>();
 194        private readonly List<NftPageView> ownedNftWearablePageViews = new List<NftPageView>();
 195        private readonly List<NftPageView> ownedNftEmotePageViews = new List<NftPageView>();
 96
 97        public override void Start()
 98        {
 099            collectiblesToggle.isOn = false;
 0100            aboutToggle.isOn = true;
 0101            aboutToggle.onValueChanged.AddListener(EnableAboutSection);
 0102            collectiblesToggle.onValueChanged.AddListener(EnableCollectiblesSection);
 0103            nftWearablesScrollRect.onValueChanged.AddListener((pos) => CloseAllNFTItemInfos());
 0104            nftEmotesScrollRect.onValueChanged.AddListener((pos) => CloseAllNFTItemInfos());
 0105            nftNamesScrollRect.onValueChanged.AddListener((pos) => CloseAllNFTItemInfos());
 0106            nftLandsScrollRect.onValueChanged.AddListener((pos) => CloseAllNFTItemInfos());
 0107            collectiblesMainScrollRect.onValueChanged.AddListener((pos) => CloseAllNFTItemInfos());
 0108        }
 109
 110        private void EnableAboutSection(bool isActive)
 111        {
 0112            aboutPanel.SetActive(isActive);
 0113            aboutText.color = Color.white;
 0114            collectiblesText.color = Color.black;
 0115            aboutToggleOn.SetActive(true);
 0116            aboutToggleOff.SetActive(false);
 0117            collectiblesToggleOn.SetActive(false);
 0118            collectiblesToggleOff.SetActive(true);
 0119            CloseAllNFTItemInfos();
 0120        }
 121
 122        private void EnableCollectiblesSection(bool isActive)
 123        {
 0124            OnClickCollectibles?.Invoke();
 0125            wearablesPanel.SetActive(isActive);
 0126            aboutText.color = Color.black;
 0127            collectiblesText.color = Color.white;
 0128            aboutToggleOn.SetActive(false);
 0129            aboutToggleOff.SetActive(true);
 0130            collectiblesToggleOn.SetActive(true);
 0131            collectiblesToggleOff.SetActive(false);
 0132            nftWearablesCarousel.ResetManualCarousel();
 0133            nftEmotesCarousel.ResetManualCarousel();
 0134            nftNamesCarousel.ResetManualCarousel();
 0135            nftLandsCarousel.ResetManualCarousel();
 0136            CloseAllNFTItemInfos();
 0137        }
 138
 139        public void InitializeView()
 140        {
 0141            nftPagesEntryPool = GetNftPagesEntryPool();
 0142            nftIconsEntryPool = GetNftIconEntryPool();
 0143            CleanWearables();
 0144            CleanEquippedWearables();
 0145            SetInitialPage();
 0146        }
 147
 148        public void SetGuestUser(bool isGuest)
 149        {
 0150            guestPanel.SetActive(isGuest);
 0151            normalPanel.SetActive(!isGuest);
 0152            hasBlockedPanel.SetActive(false);
 0153        }
 154
 155        public void SetName(string username)
 156        {
 0157            usernameText.text = $"{username} {GUEST_TEXT}";
 0158            blockedUsernameText.text = $"{username} {BLOCKED_TEXT}";
 0159        }
 160
 161        public void SetOwnUserTexts(bool isOwnUser)
 162        {
 0163            string prefix = isOwnUser ? OWN_PLAYER : OTHER_PLAYERS;
 0164            emptyWearablesText.text = $"{prefix}{NO_WEARABLES_TEXT}";
 0165            emptyEmotesText.text = $"{prefix}{NO_EMOTES_TEXT}";
 0166            emptyNamesText.text = $"{prefix}{NO_NAMES_TEXT}";
 0167            emptyLandsText.text = $"{prefix}{NO_LANDS_TEXT}";
 0168        }
 169
 170        public void SetDescription(string description)
 171        {
 0172            MatchCollection matchCollection = Regex.Matches(description, LINKS_REGEX, RegexOptions.IgnoreCase);
 0173            List<string> links = new List<string>();
 174
 0175            foreach (Match link in matchCollection)
 176            {
 0177                description = description.Replace(link.Value, "");
 0178                links.Add(link.Value);
 179            }
 180
 0181            linksTitle.SetActive(links.Count > 0);
 0182            linksContainer.SetActive(links.Count > 0);
 183
 0184            if (string.IsNullOrEmpty(description))
 185            {
 0186                emptyDescriptionGO.SetActive(true);
 0187                descriptionText.gameObject.SetActive(false);
 188            }
 189            else
 190            {
 0191                emptyDescriptionGO.SetActive(false);
 0192                descriptionText.gameObject.SetActive(true);
 0193                descriptionText.text = description;
 194            }
 195
 0196            SetLinks(links);
 0197        }
 198
 199        private void SetLinks(List<string> links)
 200        {
 0201            foreach (Transform child in linksContainer.transform) { Destroy(child.gameObject); }
 202
 0203            foreach (string link in links)
 204            {
 0205                PassportLinkView newLink = Instantiate(linkPrefabReference, linksContainer.transform).GetComponent<Passp
 0206                newLink.OnClickLink -= ClickedLink;
 0207                newLink.SetLinkTitle(Regex.Matches(link, LINK_TITLE_REGEX, RegexOptions.IgnoreCase)[0].Value);
 0208                newLink.SetLink(Regex.Matches(link, LINK_REGEX, RegexOptions.IgnoreCase)[0].Value);
 0209                newLink.OnClickLink += ClickedLink;
 210            }
 0211        }
 212
 213        private void ClickedLink(string obj)
 214        {
 0215            openUrlView.SetUrlInfo(obj, obj);
 0216            openUrlView.SetVisibility(true);
 0217            OnClickedLink?.Invoke();
 0218        }
 219
 220        public void SetEquippedWearables(WearableItem[] wearables, string bodyShapeId)
 221        {
 0222            HashSet<string> hidesList = WearableItem.ComposeHiddenCategories(bodyShapeId, wearables.ToList());
 223
 0224            equippedNftWearableViews.Clear();
 225
 0226            foreach (var wearable in wearables)
 227            {
 0228                if (!hidesList.Contains(wearable.data.category))
 229                {
 0230                    PoolableObject poolableObject = nftIconsEntryPool.Get();
 0231                    nftIconPoolableQueue.Add(poolableObject);
 0232                    poolableObject.gameObject.transform.SetParent(equippedWearablesContainer, false);
 0233                    poolableObject.gameObject.transform.localScale = NFT_ICON_SCALE;
 0234                    NFTIconComponentView nftIconComponentView = poolableObject.gameObject.GetComponent<NFTIconComponentV
 0235                    nftIconComponentView.onMarketplaceButtonClick.RemoveAllListeners();
 0236                    nftIconComponentView.onDetailInfoButtonClick.RemoveAllListeners();
 0237                    nftIconComponentView.onFocused -= FocusEquippedNftItem;
 0238                    nftIconComponentView.onMarketplaceButtonClick.AddListener(() => ClickOnBuyWearable(wearable.id, wear
 0239                    nftIconComponentView.onDetailInfoButtonClick.AddListener(() => nftIconComponentView.SetNFTItemInfoAc
 0240                    nftIconComponentView.onFocused += FocusEquippedNftItem;
 241
 0242                    NFTIconComponentModel nftModel = new NFTIconComponentModel()
 243                    {
 244                        showMarketplaceButton = wearable.IsCollectible(),
 245                        showType = wearable.IsCollectible(),
 246                        type = wearable.data.category,
 247                        marketplaceURI = "",
 248                        name = wearable.GetName(),
 249                        rarity = wearable.rarity,
 250                        imageURI = wearable.ComposeThumbnailUrl()
 251                    };
 252
 0253                    nftIconComponentView.Configure(nftModel);
 0254                    nftIconComponentView.ConfigureNFTItemInfo(nftItemInfo, wearable, true);
 0255                    equippedNftWearableViews.Add(nftIconComponentView);
 256                }
 257            }
 0258        }
 259
 260        public void SetCollectibleWearables(WearableItem[] wearables)
 261        {
 0262            nftWearablesCarousel.gameObject.SetActive(wearables.Length > 0);
 0263            nftWearablesCarousel.CleanInstantiatedItems();
 0264            emptyWearablesText.gameObject.SetActive(wearables.Length <= 0);
 0265            ownedNftWearablePageViews.Clear();
 266
 0267            for (int i = 0; i < wearables.Length; i += PAGE_SIZE)
 268            {
 0269                NftPageView nftPageView = CreateWearablePageView(wearables, i);
 0270                ownedNftWearablePageViews.Add(nftPageView);
 0271                nftWearablesCarousel.AddItem(nftPageView);
 272            }
 273
 0274            nftWearablesCarousel.SetManualControlsActive();
 0275            nftWearablesCarousel.GenerateDotsSelector();
 0276        }
 277
 278        public void SetCollectibleEmotes(WearableItem[] wearables)
 279        {
 0280            nftEmotesCarousel.gameObject.SetActive(wearables.Length > 0);
 0281            nftEmotesCarousel.CleanInstantiatedItems();
 0282            emptyEmotesText.gameObject.SetActive(wearables.Length <= 0);
 283
 0284            for (int i = 0; i < wearables.Length; i += PAGE_SIZE)
 285            {
 0286                NftPageView nftPageView = CreateEmotePageView(wearables, i);
 0287                ownedNftEmotePageViews.Add(nftPageView);
 0288                nftEmotesCarousel.AddItem(nftPageView);
 289            }
 290
 0291            nftEmotesCarousel.SetManualControlsActive();
 0292            nftEmotesCarousel.GenerateDotsSelector();
 0293        }
 294
 295        public void SetCollectibleNames(NamesResponse.NameEntry[] names)
 296        {
 0297            nftNamesCarousel.gameObject.SetActive(names.Length > 0);
 0298            nftNamesCarousel.CleanInstantiatedItems();
 0299            emptyNamesText.gameObject.SetActive(names.Length <= 0);
 300
 0301            for (int i = 0; i < names.Length; i += PAGE_SIZE)
 302            {
 0303                PoolableObject nftPagePoolElement = nftPagesEntryPool.Get();
 0304                nftPagesPoolableQueue.Add(nftPagePoolElement);
 0305                nftPagePoolElement.gameObject.transform.SetParent(nftNamesCarouselContent, false);
 0306                NftPageView nftPageView = CreateNamePageView(names, nftPagePoolElement, i);
 0307                nftNamesCarousel.AddItem(nftPageView);
 308            }
 309
 0310            nftNamesCarousel.SetManualControlsActive();
 0311            nftNamesCarousel.GenerateDotsSelector();
 0312        }
 313
 314        public void SetCollectibleLands(LandsResponse.LandEntry[] lands)
 315        {
 0316            nftLandsCarousel.gameObject.SetActive(lands.Length > 0);
 0317            nftLandsCarousel.CleanInstantiatedItems();
 0318            emptyLandsText.gameObject.SetActive(lands.Length <= 0);
 319
 0320            for (int i = 0; i < lands.Length; i += PAGE_SIZE)
 321            {
 0322                NftPageView nftPageView = CreateLandPageView(lands, i);
 0323                nftLandsCarousel.AddItem(nftPageView);
 324            }
 325
 0326            nftLandsCarousel.SetManualControlsActive();
 0327            nftLandsCarousel.GenerateDotsSelector();
 0328        }
 329
 330        public void SetHasBlockedOwnUser(bool isBlocked)
 331        {
 0332            hasBlockedPanel.SetActive(isBlocked);
 0333        }
 334
 335        public void SetInitialPage()
 336        {
 0337            aboutToggle.isOn = true;
 0338        }
 339
 340        public void CloseAllNFTItemInfos()
 341        {
 0342            for (int i = 0; i < equippedNftWearableViews.Count; i++)
 0343                equippedNftWearableViews[i].SetNFTItemInfoActive(false);
 344
 0345            for (int i = 0; i < ownedNftWearablePageViews.Count; i++)
 0346                ownedNftWearablePageViews[i].CloseAllNFTItemInfos();
 347
 0348            for (int i = 0; i < ownedNftEmotePageViews.Count; i++)
 0349                ownedNftEmotePageViews[i].CloseAllNFTItemInfos();
 0350        }
 351
 352        private void ClickOnBuyWearable(string wearableId, string wearableType)
 353        {
 0354            OnClickBuyNft?.Invoke(wearableId, wearableType);
 0355        }
 356
 357        private void FocusEquippedNftItem(bool isFocused)
 358        {
 0359            if (!isFocused)
 0360                return;
 361
 0362            FocusAnyNtfItem();
 0363        }
 364
 365        private void FocusAnyNtfItem() =>
 0366            CloseAllNFTItemInfos();
 367
 368        private void CleanEquippedWearables()
 369        {
 0370            foreach (var poolObject in nftIconPoolableQueue) { nftIconsEntryPool.Release(poolObject); }
 371
 0372            nftIconPoolableQueue = new List<PoolableObject>();
 0373        }
 374
 375        private void CleanWearables()
 376        {
 0377            foreach (var poolObject in nftPagesPoolableQueue) { nftPagesEntryPool.Release(poolObject); }
 378
 0379            nftPagesPoolableQueue = new List<PoolableObject>();
 0380        }
 381
 382        private Pool GetNftIconEntryPool()
 383        {
 0384            var pool = PoolManager.i.GetPool(NFT_ICON_POOL_NAME_PREFIX + name + GetInstanceID());
 0385            if (pool != null) return pool;
 386
 0387            pool = PoolManager.i.AddPool(
 388                NFT_ICON_POOL_NAME_PREFIX + name + GetInstanceID(),
 389                Instantiate(wearableUIReferenceObject).gameObject,
 390                maxPrewarmCount: MAX_NFT_ICON_ENTRIES,
 391                isPersistent: true);
 392
 0393            pool.ForcePrewarm();
 394
 0395            return pool;
 396        }
 397
 398        private Pool GetNftPagesEntryPool()
 399        {
 0400            var pool = PoolManager.i.GetPool(NFT_PAGES_POOL_NAME_PREFIX + name + GetInstanceID());
 0401            if (pool != null) return pool;
 402
 0403            pool = PoolManager.i.AddPool(
 404                NFT_PAGES_POOL_NAME_PREFIX + name + GetInstanceID(),
 405                Instantiate(nftPageUIReferenceObject).gameObject,
 406                maxPrewarmCount: MAX_NFT_PAGES_ENTRIES,
 407                isPersistent: true);
 408
 0409            pool.ForcePrewarm();
 410
 0411            return pool;
 412        }
 413
 0414        public override void RefreshControl() { }
 415
 416        public void SetCollectibleWearablesLoadingActive(bool isActive) =>
 0417            SetCollectibleSectionLoadingActive(isActive, nftWearablesCarousel, emptyWearablesText.gameObject, nftWearabl
 418
 419        public void SetCollectibleEmotesLoadingActive(bool isActive) =>
 0420            SetCollectibleSectionLoadingActive(isActive, nftEmotesCarousel, emptyEmotesText.gameObject, nftEmotesLoading
 421
 422        public void SetCollectibleNamesLoadingActive(bool isActive) =>
 0423            SetCollectibleSectionLoadingActive(isActive, nftNamesCarousel, emptyNamesText.gameObject, nftNamesLoadingSpi
 424
 425        public void SetCollectibleLandsLoadingActive(bool isActive) =>
 0426            SetCollectibleSectionLoadingActive(isActive, nftLandsCarousel, emptyLandsText.gameObject, nftLandsLoadingSpi
 427
 428        private void SetCollectibleSectionLoadingActive(
 429            bool isActive,
 430            CarouselComponentView carousel,
 431            GameObject emptyText,
 432            GameObject loadingSpinner)
 433        {
 0434            if (isActive)
 435            {
 0436                carousel.gameObject.SetActive(false);
 0437                emptyText.SetActive(false);
 438            }
 439
 0440            loadingSpinner.SetActive(isActive);
 0441        }
 442
 443        private NftPageView CreateNamePageView(NamesResponse.NameEntry[] names, PoolableObject nftPagePoolElement, int i
 444        {
 0445            NftPageView nftPageView = nftPagePoolElement.gameObject.GetComponent<NftPageView>();
 0446            nftPageView.OnClickBuyNft -= ClickOnBuyWearable;
 0447            nftPageView.OnFocusAnyNtf -= FocusAnyNtfItem;
 0448            NFTIconComponentModel[] pageElements = CreateNamePageElements(names, i);
 0449            nftPageView.SetPageElementsContent(pageElements);
 0450            nftPageView.IsNftInfoActived = false;
 0451            nftPageView.OnClickBuyNft += ClickOnBuyWearable;
 0452            nftPageView.OnFocusAnyNtf += FocusAnyNtfItem;
 0453            return nftPageView;
 454        }
 455
 456        private static NFTIconComponentModel[] CreateNamePageElements(NamesResponse.NameEntry[] names, int i)
 457        {
 0458            NFTIconComponentModel[] pageElements = new NFTIconComponentModel[PAGE_SIZE];
 459
 0460            for (var j = 0; j < PAGE_SIZE; j++)
 461            {
 0462                if (names.Length > i + j && names[i + j] != null)
 463                {
 0464                    pageElements[j] = new NFTIconComponentModel
 465                    {
 466                        showMarketplaceButton = true,
 467                        showType = true,
 468                        type = NAME_TYPE,
 469                        marketplaceURI = "",
 470                        name = names[i + j].Name,
 471                        rarity = LEGENDARY_RARITY,
 472                        imageURI = "",
 473                        nftId = (names[i + j].ContractAddress, NAME_TYPE)
 474                    };
 475                }
 476                else
 477                {
 0478                    pageElements[j] = null;
 479                }
 480            }
 481
 0482            return pageElements;
 483        }
 484
 485        private NftPageView CreateWearablePageView(WearableItem[] wearables, int i)
 486        {
 0487            PoolableObject nftPagePoolElement = nftPagesEntryPool.Get();
 0488            nftPagesPoolableQueue.Add(nftPagePoolElement);
 0489            nftPagePoolElement.gameObject.transform.SetParent(nftWearablesCarouselContent, false);
 0490            NftPageView nftPageView = nftPagePoolElement.gameObject.GetComponent<NftPageView>();
 0491            nftPageView.OnClickBuyNft -= ClickOnBuyWearable;
 0492            nftPageView.OnFocusAnyNtf -= FocusAnyNtfItem;
 0493            NFTIconComponentModel[] pageElements = new NFTIconComponentModel[PAGE_SIZE];
 0494            WearableItem[] wearableItemsForThisPage = new WearableItem[PAGE_SIZE];
 495
 0496            for (int j = 0; j < PAGE_SIZE; j++)
 497            {
 0498                if (wearables.Length > i + j && wearables[i + j] != null)
 499                {
 0500                    pageElements[j] = new()
 501                    {
 502                        showMarketplaceButton = true,
 503                        showType = true,
 504                        type = wearables[i + j].data.category,
 505                        marketplaceURI = "",
 506                        name = wearables[i + j].GetName(),
 507                        rarity = wearables[i + j].rarity,
 508                        imageURI = wearables[i + j].ComposeThumbnailUrl(),
 509                        nftId = (wearables[i + j].id, wearables[i + j].data.category)
 510                    };
 0511                    wearableItemsForThisPage[j] = wearables[i + j];
 512                }
 513                else
 514                {
 0515                    pageElements[j] = null;
 0516                    wearableItemsForThisPage[j] = null;
 517                }
 518            }
 519
 0520            nftPageView.SetPageElementsContent(pageElements);
 0521            nftPageView.IsNftInfoActived = true;
 0522            nftPageView.ConfigureNFTItemInfo(nftItemInfo, wearableItemsForThisPage, true);
 0523            nftPageView.OnClickBuyNft += ClickOnBuyWearable;
 0524            nftPageView.OnFocusAnyNtf += FocusAnyNtfItem;
 0525            return nftPageView;
 526        }
 527
 528        private NftPageView CreateEmotePageView(WearableItem[] wearables, int i)
 529        {
 0530            PoolableObject nftPagePoolElement = nftPagesEntryPool.Get();
 0531            nftPagesPoolableQueue.Add(nftPagePoolElement);
 0532            nftPagePoolElement.gameObject.transform.SetParent(nftEmotesCarouselContent, false);
 0533            NftPageView nftPageView = nftPagePoolElement.gameObject.GetComponent<NftPageView>();
 0534            nftPageView.OnClickBuyNft -= ClickOnBuyWearable;
 0535            nftPageView.OnFocusAnyNtf -= FocusAnyNtfItem;
 0536            NFTIconComponentModel[] pageElements = new NFTIconComponentModel[PAGE_SIZE];
 0537            WearableItem[] wearableItemsForThisPage = new WearableItem[PAGE_SIZE];
 538
 0539            for (var j = 0; j < PAGE_SIZE; j++)
 540            {
 0541                if (wearables.Length > i + j && wearables[i + j] != null)
 542                {
 0543                    pageElements[j] = new NFTIconComponentModel
 544                    {
 545                        showMarketplaceButton = true,
 546                        showType = true,
 547                        type = EMOTE_TYPE,
 548                        marketplaceURI = "",
 549                        name = wearables[i + j].GetName(),
 550                        rarity = wearables[i + j].rarity,
 551                        imageURI = wearables[i + j].ComposeThumbnailUrl(),
 552                        nftId = (wearables[i + j].id, EMOTE_TYPE)
 553                    };
 554
 0555                    wearableItemsForThisPage[j] = wearables[i + j];
 556                }
 557                else
 558                {
 0559                    pageElements[j] = null;
 0560                    wearableItemsForThisPage[j] = null;
 561                }
 562            }
 563
 0564            nftPageView.SetPageElementsContent(pageElements);
 0565            nftPageView.IsNftInfoActived = true;
 0566            nftPageView.ConfigureNFTItemInfo(nftItemInfo, wearableItemsForThisPage, false);
 0567            nftPageView.OnClickBuyNft += ClickOnBuyWearable;
 0568            nftPageView.OnFocusAnyNtf += FocusAnyNtfItem;
 0569            return nftPageView;
 570        }
 571
 572        private NftPageView CreateLandPageView(LandsResponse.LandEntry[] lands, int i)
 573        {
 0574            PoolableObject nftPagePoolElement = nftPagesEntryPool.Get();
 0575            nftPagesPoolableQueue.Add(nftPagePoolElement);
 0576            nftPagePoolElement.gameObject.transform.SetParent(nftLandsCarouselContent, false);
 0577            NftPageView nftPageView = nftPagePoolElement.gameObject.GetComponent<NftPageView>();
 0578            nftPageView.OnClickBuyNft -= ClickOnBuyWearable;
 0579            nftPageView.OnFocusAnyNtf -= FocusAnyNtfItem;
 0580            NFTIconComponentModel[] pageElements = new NFTIconComponentModel[PAGE_SIZE];
 581
 0582            for (int j = 0; j < PAGE_SIZE; j++)
 583            {
 0584                if (lands.Length > i + j && lands[i + j] != null)
 585                {
 0586                    pageElements[j] = new()
 587                    {
 588                        showMarketplaceButton = true,
 589                        showType = true,
 590                        type = lands[i + j].Category,
 591                        marketplaceURI = "",
 592                        name = !string.IsNullOrEmpty(lands[i + j].Name) ? lands[i + j].Name : lands[i + j].Category,
 593                        rarity = LAND_RARITY,
 594                        imageURI = lands[i + j].Image,
 595                        nftId = (lands[i + j].ContractAddress, lands[i + j].Category)
 596                    };
 597                }
 598                else
 599                {
 0600                    pageElements[j] = null;
 601                }
 602            }
 603
 0604            nftPageView.SetPageElementsContent(pageElements);
 0605            nftPageView.IsNftInfoActived = false;
 0606            nftPageView.OnClickBuyNft += ClickOnBuyWearable;
 0607            nftPageView.OnFocusAnyNtf += FocusAnyNtfItem;
 0608            return nftPageView;
 609        }
 610    }
 611}

Methods/Properties

PassportNavigationComponentView()
PassportNavigationComponentView()
Start()
EnableAboutSection(System.Boolean)
EnableCollectiblesSection(System.Boolean)
InitializeView()
SetGuestUser(System.Boolean)
SetName(System.String)
SetOwnUserTexts(System.Boolean)
SetDescription(System.String)
SetLinks(System.Collections.Generic.List[String])
ClickedLink(System.String)
SetEquippedWearables(WearableItem[], System.String)
SetCollectibleWearables(WearableItem[])
SetCollectibleEmotes(WearableItem[])
SetCollectibleNames(DCLServices.Lambdas.NamesService.NamesResponse/NameEntry[])
SetCollectibleLands(DCLServices.Lambdas.LandsService.LandsResponse/LandEntry[])
SetHasBlockedOwnUser(System.Boolean)
SetInitialPage()
CloseAllNFTItemInfos()
ClickOnBuyWearable(System.String, System.String)
FocusEquippedNftItem(System.Boolean)
FocusAnyNtfItem()
CleanEquippedWearables()
CleanWearables()
GetNftIconEntryPool()
GetNftPagesEntryPool()
RefreshControl()
SetCollectibleWearablesLoadingActive(System.Boolean)
SetCollectibleEmotesLoadingActive(System.Boolean)
SetCollectibleNamesLoadingActive(System.Boolean)
SetCollectibleLandsLoadingActive(System.Boolean)
SetCollectibleSectionLoadingActive(System.Boolean, CarouselComponentView, UnityEngine.GameObject, UnityEngine.GameObject)
CreateNamePageView(DCLServices.Lambdas.NamesService.NamesResponse/NameEntry[], DCL.PoolableObject, System.Int32)
CreateNamePageElements(DCLServices.Lambdas.NamesService.NamesResponse/NameEntry[], System.Int32)
CreateWearablePageView(WearableItem[], System.Int32)
CreateEmotePageView(WearableItem[], System.Int32)
CreateLandPageView(DCLServices.Lambdas.LandsService.LandsResponse/LandEntry[], System.Int32)