public IAPContentSetting Clone()
        {
            IAPContentSetting obj = new IAPContentSetting();

            this.uid    = obj.uid;
            this.amount = obj.amount;
            this.type   = obj.type;
            return(obj);
        }
Beispiel #2
0
        /// <summary>
        /// initialize virtual or real item properties
        /// based on IAPObject info set in IAP Settings editor.
        /// Called by ShopManager
        /// </summary>
        public void Init(IAPObject prod)
        {
            //cache
            type = prod.type;
            string name = prod.title;
            string descr = prod.description.Replace("\\n", "\n");
            string lockText = prod.req.labelText;

            //store the item id for later purposes
            productId = prod.id;
            //set icon to the matching sprite
            if (icon) icon.sprite = prod.icon;

            //when 'uppercase' has been checked,
            //convert title and description text to uppercase,
            //otherwise just keep and set them as they are
            if (uppercase)
            {
                name = name.ToUpper();
                descr = descr.ToUpper();
                lockText = lockText.ToUpper();
            }

            //set descriptive labels
            if (title) title.text = name;
            if (description) description.text = descr;
            
            //set price value
            if (IAPManager.IsMarketItem(productId))
                price.text = prod.realPrice.ToString();
            else if (!string.IsNullOrEmpty(prod.virtualPrice.name))
                price.text = prod.virtualPrice.amount.ToString();

            //set locked label text in case a requirement has been set
            if (lockedLabel && !string.IsNullOrEmpty(prod.req.entry)
                && !string.IsNullOrEmpty(prod.req.labelText))
                lockedLabel.text = lockText;
        }
Beispiel #3
0
        /// <summary>
        /// initialize virtual or real item properties
        /// based on IAPObject info set in IAP Settings editor.
        /// Called by ShopManager
        /// </summary>
        public void Init(IAPObject prod)
        {
            //cache
            type = prod.type;
            string name = prod.title;
            string descr = prod.description.Replace("\\n", "\n");
            string lockText = prod.req.labelText;

            //store the item id for later purposes
            productId = prod.id;
            //set icon to the matching sprite
            if (icon) icon.sprite = prod.icon;

            //when 'uppercase' has been checked,
            //convert title and description text to uppercase,
            //otherwise just keep and set them as they are
            if (uppercase)
            {
                name = name.ToUpper();
                descr = descr.ToUpper();
                lockText = lockText.ToUpper();
            }

            if (title) title.text = name;
            if (description) description.text = descr;

            if (type == IAPType.consumable || type == IAPType.nonConsumable
                || type == IAPType.subscription)
            {
                //purchases for real money have only one price value,
                //so we just use the first entry of the price label array
                if (price.Length > 0) price[0].text = prod.realPrice;
            }
            else if (prod.virtualPrice.Count > 0)
            {
                //purchases for virtual currency could have more than one price value,
                //so we loop over all entries and set the corresponding price label
                for (int i = 0; i < price.Length; i++)
                    if (price[i]) price[i].text = prod.virtualPrice[i].amount.ToString();
            }

            //set locked label text in case a requirement has been set
            if (lockedLabel && !string.IsNullOrEmpty(prod.req.entry)
                && !string.IsNullOrEmpty(prod.req.labelText))
                lockedLabel.text = lockText;
        }
Beispiel #4
0
        /// <summary>
        /// initialize virtual or real item properties
        /// based on IAPObject info set in IAP Settings editor.
        /// Called by ShopManager
        /// </summary>
        public void Init(IAPObject prod)
        {
            //cache
            type = prod.type;
            string name     = prod.title;
            string descr    = prod.description.Replace("\\n", "\n");
            string lockText = prod.req.labelText;

            //store the item id for later purposes
            productId = prod.id;
            //set icon to the matching sprite
            if (icon)
            {
                icon.sprite = prod.icon;
            }

            //when 'uppercase' has been checked,
            //convert title and description text to uppercase,
            //otherwise just keep and set them as they are
            if (uppercase)
            {
                name     = name.ToUpper();
                descr    = descr.ToUpper();
                lockText = lockText.ToUpper();
            }

            if (title)
            {
                title.text = name;
            }
            if (description)
            {
                description.text = descr;
            }

            if (type == IAPType.consumable || type == IAPType.nonConsumable ||
                type == IAPType.subscription)
            {
                //purchases for real money have only one price value,
                //so we just use the first entry of the price label array
                if (price.Length > 0)
                {
                    price[0].text = prod.realPrice;
                }
            }
            else if (prod.virtualPrice.Count > 0)
            {
                //purchases for virtual currency could have more than one price value,
                //so we loop over all entries and set the corresponding price label
                for (int i = 0; i < price.Length; i++)
                {
                    if (price[i])
                    {
                        price[i].text = prod.virtualPrice[i].amount.ToString();
                    }
                }
            }

            //set locked label text in case a requirement has been set
            if (lockedLabel && !string.IsNullOrEmpty(prod.req.entry) &&
                !string.IsNullOrEmpty(prod.req.labelText))
            {
                lockedLabel.text = lockText;
            }
        }