Beispiel #1
0
        public void SetUpButton(CatalogItemData catalogItemData, Color foreground, Color background, bool isCreatorNameHidden = false)
        {
            itemData = catalogItemData;
            DCustomEquipment equipment = CustomEquipmentResponseAdaptor.ConvertResponseToCustomEquipment(itemData.equipment);

            if (isCreatorNameHidden)
            {
                DisableName();
            }
            CreatorNameText.text = itemData.creatorName;
            CatalogItemIcon component = GetComponent <CatalogItemIcon>();

            AbstractImageBuilder.CallbackToken callbackToken = default(AbstractImageBuilder.CallbackToken);
            callbackToken.Id           = itemData.clothingCatalogItemId;
            callbackToken.DefinitionId = equipment.DefinitionId;
            base.itemImageBuilder.RequestImage(equipment, component.SetIcon, callbackToken, background, foreground);
            if (!isAlreadyOwned)
            {
                isAlreadyOwned = ((itemData.equipment.equipmentId != 0) ? true : false);
            }
            ItemOwned.SetActive(isAlreadyOwned);
            PriceTagText.text = itemData.cost.ToString();
            PriceTag.SetActive(!isAlreadyOwned);
            int definitionId = equipment.DefinitionId;
            Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >();
            TemplateDefinition templateDefinition           = dictionary.Values.ToList().First((TemplateDefinition x) => x.Id == definitionId);

            isMemberUnlocked = !templateDefinition.IsMemberOnly || Service.Get <CPDataEntityCollection>().IsLocalPlayerMember();
            if (!isMemberUnlocked)
            {
                MemberLock.SetActive(value: true);
            }
        }
        private void addChallengeItem(int currentThemeDataIndex)
        {
            GameObject gameObject = UnityEngine.Object.Instantiate(ChallengeItem);

            gameObject.transform.SetParent(scrollRectContent, worldPositionStays: false);
            CatalogChallengeItem component = gameObject.GetComponent <CatalogChallengeItem>();

            component.SetChallengeTheme(themes[currentThemeDataIndex], currentThemeDataIndex);
            CatalogItemIcon  component2       = gameObject.GetComponent <CatalogItemIcon>();
            CurrentThemeData currentThemeData = themes[currentThemeDataIndex];

            if (currentThemeData.mostPopularItem.HasValue)
            {
                DCustomEquipment equipment     = CustomEquipmentResponseAdaptor.ConvertResponseToCustomEquipment(currentThemeData.mostPopularItem.Value.equipment);
                Color[]          colorsByIndex = Service.Get <CatalogServiceProxy>().themeColors.GetColorsByIndex(currentThemeDataIndex);
                AbstractImageBuilder.CallbackToken callbackToken = default(AbstractImageBuilder.CallbackToken);
                callbackToken.Id           = ((equipment.Id == 0) ? currentThemeData.mostPopularItem.Value.clothingCatalogItemId : equipment.Id);
                callbackToken.DefinitionId = equipment.DefinitionId;
                base.itemImageBuilder.RequestImage(equipment, component2.SetIcon, callbackToken, Color.clear, colorsByIndex[0]);
            }
        }