Example #1
0
    private AirdroppingItemPanel CreateItemPanel(Transform parent, AirdroppingHUDController.ItemModel model)
    {
        AirdroppingItemPanel item = null;

        if (model.type == "collectible")
        {
            item = collectiblesFactory.Instantiate <AirdroppingItemPanel>(model.rarity, parent);
        }

        if (model.type == "erc20")
        {
            item = erc20Factory.Instantiate <AirdroppingItemPanel>(model.rarity, parent);
        }

        return(item);
    }
    public void SetUserProfile(UserProfile userProfile)
    {
        Assert.IsTrue(userProfile != null, "userProfile can't be null");

        currentUserProfile    = userProfile;
        name.text             = currentUserProfile.userName;
        description.text      = currentUserProfile.description;
        avatarPicture.texture = currentUserProfile.faceSnapshot;

        ClearCollectibles();

        CatalogController.RequestOwnedWearables(userProfile.userId)
        .Then((ownedWearables) =>
        {
            currentUserProfile.SetInventory(ownedWearables.Select(x => x.id).ToArray());
            loadedWearables.AddRange(ownedWearables.Select(x => x.id));

            var collectiblesIds = currentUserProfile.GetInventoryItemsIds();
            for (int index = 0; index < collectiblesIds.Length; index++)
            {
                string collectibleId = collectiblesIds[index];
                CatalogController.wearableCatalog.TryGetValue(collectibleId, out WearableItem collectible);
                if (collectible == null)
                {
                    continue;
                }

                var playerInfoCollectible =
                    collectiblesFactory.Instantiate <PlayerInfoCollectibleItem>(collectible.rarity,
                                                                                wearablesContainer.transform);
                if (playerInfoCollectible == null)
                {
                    continue;
                }
                playerInfoCollectibles.Add(playerInfoCollectible);
                playerInfoCollectible.Initialize(collectible);
            }

            emptyCollectiblesImage.SetActive(collectiblesIds.Length == 0);
        })
        .Catch((error) => Debug.Log(error));

        SetIsBlocked(IsBlocked(userProfile.userId));

        UpdateFriendButton();
    }
Example #3
0
    public void SetUserProfile(UserProfile userProfile)
    {
        Assert.IsTrue(userProfile != null, "userProfile can't be null");

        currentUserProfile   = userProfile;
        name.text            = currentUserProfile.userName;
        description.text     = currentUserProfile.description;
        avatarPicture.sprite = currentUserProfile.faceSnapshot;

        ClearCollectibles();
        var collectiblesIds = currentUserProfile.GetInventoryItemsIds();

        for (int index = 0; index < collectiblesIds.Length; index++)
        {
            string       collectibleId = collectiblesIds[index];
            WearableItem collectible   = CatalogController.wearableCatalog.Get(collectibleId);
            if (collectible == null)
            {
                continue;
            }

            var playerInfoCollectible =
                collectiblesFactory.Instantiate <PlayerInfoCollectibleItem>(collectible.rarity,
                                                                            wearablesContainer.transform);
            if (playerInfoCollectible == null)
            {
                continue;
            }
            playerInfoCollectibles.Add(playerInfoCollectible);
            playerInfoCollectible.Initialize(collectible);
        }

        emptyCollectiblesImage.SetActive(collectiblesIds.Length == 0);

        SetIsBlocked(IsBlocked(userProfile.userId));

        UpdateFriendButton();
    }