示例#1
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);
        }