示例#1
0
        public static bool IsIglooReward(DisneyStoreItemData item)
        {
            bool           result  = false;
            List <DReward> rewards = item.GetRewards();

            for (int i = 0; i < rewards.Count; i++)
            {
                result = IsIglooReward(rewards[i].Category);
            }
            return(result);
        }
示例#2
0
        public static RewardCategory GetItemRewardCategory(DisneyStoreItemData item)
        {
            List <DReward> rewards = item.GetRewards();
            RewardCategory result  = RewardCategory.equipmentInstances;

            if (rewards.Count > 0)
            {
                result = rewards[0].Category;
            }
            return(result);
        }
        protected void setPurchaseActionText(DisneyStoreItemData item)
        {
            List <DReward> rewards  = item.GetRewards();
            RewardCategory category = rewards[0].Category;
            string         token    = "GlobalUI.Buttons.Use";

            if (category == RewardCategory.equipmentInstances)
            {
                token = "Marketplace.DisneyShop.WearButton";
            }
            PurchasedActionText.text = Service.Get <Localizer>().GetTokenTranslation(token);
        }
        private bool isItemEquippable(DisneyStoreItemData itemData)
        {
            List <DReward> rewards = itemData.GetRewards();

            for (int i = 0; i < rewards.Count; i++)
            {
                if (rewards[i].Category == RewardCategory.equipmentInstances || rewards[i].Category == RewardCategory.durables || rewards[i].Category == RewardCategory.equipmentTemplates || rewards[i].Category == RewardCategory.fabrics || rewards[i].Category == RewardCategory.decals || rewards[i].Category == RewardCategory.colourPacks || rewards[i].Category == RewardCategory.consumables)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#5
0
        public static bool DoesItemContainEquipmentInstance(DisneyStoreItemData item)
        {
            List <DReward> rewards = item.GetRewards();
            bool           result  = false;

            for (int i = 0; i < rewards.Count; i++)
            {
                if (rewards[i].Category == RewardCategory.equipmentInstances)
                {
                    result = true;
                    break;
                }
            }
            return(result);
        }
        protected void selectTrayIcons(DisneyStoreItemData item)
        {
            List <DReward> rewards  = item.GetRewards();
            RewardCategory category = rewards[0].Category;
            int            num      = (DisneyStoreUtils.IsIglooReward(item) ? 3 : Array.IndexOf(TrayIconImageSelectorCategoryIndexes, category));

            if (num != -1 || num >= TrayIconImageSelector.Sprites.Length)
            {
                TrayIconImageSelector.SelectSprite(num);
            }
            else
            {
                TrayIconImageSelector.SelectSprite(0);
            }
        }
 public void OnUseItClicked()
 {
     if (currentState == ConfirmationState.Complete)
     {
         List <DReward> rewards  = item.GetRewards();
         RewardCategory category = rewards[0].Category;
         if (category == RewardCategory.durables || category == RewardCategory.consumables)
         {
             equipProp(rewards[0]);
         }
         else
         {
             jumpToClothingDesigner(rewards[0]);
         }
         logUseItem();
     }
 }
示例#8
0
        public static bool IsItemMultiPurchase(DisneyStoreItemData item)
        {
            List <DReward> rewards = item.GetRewards();
            bool           flag    = false;
            bool           flag2   = false;

            for (int i = 0; i < rewards.Count; i++)
            {
                if (rewards[i].Category == RewardCategory.consumables || rewards[i].Category == RewardCategory.decorationInstances)
                {
                    flag = true;
                    continue;
                }
                flag2 = true;
                break;
            }
            return(flag && !flag2);
        }
示例#9
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;
            }
            }
        }
示例#10
0
        public static bool IsItemOwned(DisneyStoreItemData item)
        {
            List <DReward> rewards = item.GetRewards();

            for (int i = 0; i < rewards.Count; i++)
            {
                if (rewards[i].Category == RewardCategory.equipmentInstances)
                {
                    if (!InventoryUtils.IsCustomEquipmentOwned(rewards[i].EquipmentRequest))
                    {
                        return(false);
                    }
                }
                else if (Enum.IsDefined(typeof(ProgressionUnlockCategory), rewards[i].Category.ToString()))
                {
                    ProgressionUnlockCategory category = (ProgressionUnlockCategory)Enum.Parse(typeof(ProgressionUnlockCategory), rewards[i].Category.ToString());
                    if (!Service.Get <ProgressionService>().IsUnlocked(rewards[i].UnlockID, category))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
 protected void logItemViewed(DisneyStoreItemData item)
 {
     Service.Get <ICPSwrveService>().Action("game.disney_store_item_view", item.Definition.name, item.GetRewards()[0].Category.ToString());
 }