Exemple #1
0
        public IAPAbilityLevel Clone()
        {
            IAPAbilityLevel obj = new IAPAbilityLevel();

            obj.description = this.description;
            obj.price       = this.price;
            obj.icon        = this.icon;

            return(obj);
        }
Exemple #2
0
        public IAPAbilityLevel GetCurrentLevel()
        {
            IAPAbilityLevel lv = null;

            if (levels != null && level < levels.Count)
            {
                lv = levels[level];
            }

            return(lv);
        }
Exemple #3
0
        /// <summary>
        /// Purchase this instance.
        /// </summary>
        public bool Upgrade()
        {
            bool result = false;
            // Get the currency
            IAPCurrency cur = IAPInventoryManager.GetCurrency(this.currency);
            // Get the Level Object
            IAPAbilityLevel lv = null;

            if (levels != null && level < levels.Count - 1)
            {
                lv = levels[level];
                // Check if enough currency
                // Consume package, delay the save process until next save
                if (cur != null && cur.Consume(lv.price, true))
                {
                    // Upgrade
                    _data.lv += 1;
                    result    = true;
                    //
                    Save();
                }
            }
            return(result);
        }