Esempio n. 1
0
        private IEnumerator renderClothingTemplate(int unlockID)
        {
            Dictionary <int, TemplateDefinition> templates = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >();
            Texture2DContentKey iconContentKey             = RewardPopupConstants.DefaultIconContentKey;

            if (templates.TryGetValue(unlockID, out var definition))
            {
                iconContentKey = EquipmentPathUtil.GetEquipmentIconPath(definition.AssetName);
            }
            AssetRequest <Texture2D> assetRequest = Content.LoadAsync(iconContentKey);

            yield return(assetRequest);

            callback(Sprite.Create(assetRequest.Asset, new Rect(0f, 0f, assetRequest.Asset.width, assetRequest.Asset.height), Vector2.zero), null, definition.Name);
        }
        private void onObjectAdded(RectTransform item, int index)
        {
            TemplateIcon      component         = item.GetComponent <TemplateIcon>();
            DisplayedTemplate displayedTemplate = displayedTemplates[index];

            component.gameObject.name = displayedTemplate.Definition.AssetName + "_button";
            RectTransform rectTransform = component.transform as RectTransform;

            rectTransform.anchoredPosition = Vector2.zero;
            rectTransform.anchorMin        = Vector2.zero;
            rectTransform.anchorMax        = Vector2.one;
            rectTransform.sizeDelta        = Vector2.zero;
            rectTransform.localScale       = Vector3.one;
            bool flag    = Service.Get <CPDataEntityCollection>().IsLocalPlayerMember();
            bool canDrag = flag;

            if (!flag)
            {
                canDrag = !displayedTemplate.Definition.IsMemberOnlyCreatable;
            }
            string assetName = displayedTemplate.Definition.AssetName;
            Texture2DContentKey equipmentIconPath = EquipmentPathUtil.GetEquipmentIconPath(assetName);

            component.Init(equipmentIconPath, BreadcrumbType, displayedTemplate.Definition.Id, canDrag);
            if (!flag && displayedTemplate.Definition.IsMemberOnlyCreatable)
            {
                component.SetTemplateMemberLocked(displayedTemplate.Definition);
            }
            else if (userLevel < displayedTemplate.Level)
            {
                component.SetTemplateToLevelLocked(displayedTemplate.Definition, displayedTemplate.Level);
            }
            else if (!string.IsNullOrEmpty(displayedTemplate.MascotName))
            {
                component.SetTemplateToProgressionLocked(displayedTemplate.Definition, displayedTemplate.MascotName);
            }
            else
            {
                component.SetTemplateToUnlocked(displayedTemplate.Definition);
            }
            AccessibilitySettings component2 = component.GetComponent <AccessibilitySettings>();

            if (component2 != null)
            {
                component2.CustomToken = displayedTemplate.Definition.Name;
            }
        }
Esempio n. 3
0
        private void loadItemIcon(DisneyStoreItemData item)
        {
            if (item.Definition.Icon != null && !string.IsNullOrEmpty(item.Definition.Icon.Key))
            {
                Content.LoadAsync(onCustomIconLoadComplete, item.Definition.Icon);
                return;
            }
            List <DReward> rewards = item.GetRewards();

            switch (rewards[0].Category)
            {
            case RewardCategory.equipmentTemplates:
            {
                Dictionary <int, TemplateDefinition> dictionary2 = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >();
                if (dictionary2.TryGetValue((int)rewards[0].UnlockID, out var value2))
                {
                    Texture2DContentKey equipmentIconPath = EquipmentPathUtil.GetEquipmentIconPath(value2.AssetName);
                    Content.LoadAsync(delegate(string key, Texture2D texture)
                        {
                            onIconReady(texture, 0);
                        }, equipmentIconPath);
                }
                break;
            }

            case RewardCategory.equipmentInstances:
                renderRewardItem(rewards[0].EquipmentRequest.definitionId, CustomEquipmentResponseAdaptor.ConvertResponseToCustomEquipment(rewards[0].EquipmentRequest));
                break;

            case RewardCategory.decorationInstances:
            {
                Dictionary <int, DecorationDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, DecorationDefinition> >();
                if (dictionary.TryGetValue((int)rewards[0].UnlockID, out var value))
                {
                    Content.LoadAsync(delegate(string path, Texture2D asset)
                        {
                            onIconReady(asset, 1);
                        }, value.Icon);
                }
                break;
            }
            }
        }
        private void loadItemIcon(MarketplaceEventItem item)
        {
            List <DReward> rewards = item.GetRewards();

            for (int i = 0; i < rewards.Count; i++)
            {
                TemplateDefinition value;
                switch (rewards[i].Category)
                {
                case RewardCategory.equipmentTemplates:
                {
                    Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >();
                    if (dictionary.TryGetValue((int)rewards[0].UnlockID, out value))
                    {
                        Texture2DContentKey equipmentIconPath = EquipmentPathUtil.GetEquipmentIconPath(value.AssetName);
                        Content.LoadAsync(delegate(string key, Texture2D texture)
                            {
                                onIconReady(texture);
                            }, equipmentIconPath);
                        TitleText.text = Service.Get <Localizer>().GetTokenTranslation(value.Name);
                        itemNameForBI  = value.AssetName;
                        isMemberOnly   = value.IsMemberOnly;
                    }
                    return;
                }

                case RewardCategory.equipmentInstances:
                {
                    Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >();
                    if (dictionary.TryGetValue(rewards[0].EquipmentRequest.definitionId, out value))
                    {
                        TitleText.text = Service.Get <Localizer>().GetTokenTranslation(value.Name);
                        itemNameForBI  = value.AssetName;
                        isMemberOnly   = value.IsMemberOnly;
                    }
                    renderRewardItem(rewards[0].EquipmentRequest.definitionId, CustomEquipmentResponseAdaptor.ConvertResponseToCustomEquipment(rewards[0].EquipmentRequest));
                    return;
                }
                }
            }
        }