Example #1
0
 /// <summary>
 /// Updates the button to work for the next level.
 /// </summary>
 /// <param name="button"></param>
 public void UpdateButton(ShopButtonEntity button)
 {
     var lUpgrade = this.ShopData.Upgrades.Single(x => x.ID == button.ID);
     var lPrice = lUpgrade.Prices.SingleOrDefault(x => x.Level == button.Level + 1);
     this.LoadButton(button, lUpgrade, lPrice);
 }
Example #2
0
        /// <summary>
        /// Creates a ShopButtonEntity with the given UpgradeID.
        /// </summary>
        /// <param name="upgradeID">The ID of the Upgrade.</param>
        /// <param name="playerLevel">The level the player is currently for the given upgrade.</param>
        /// <returns>The new ShopButtonEntity</returns>
        private ShopButtonEntity CreateButton(int upgradeID, int playerLevel)
        {
            var lUpgrade = this.ShopData.Upgrades.Single(x => x.ID == upgradeID);
            var lPrice = lUpgrade.Prices.SingleOrDefault(x => x.Level == playerLevel + 1);

            var lButton = new ShopButtonEntity();
            this.LoadButton(lButton, lUpgrade, lPrice);
            return lButton;
        }
Example #3
0
        /// <summary>
        /// Populates the given button with the specified upgrade and price.
        /// </summary>
        /// <param name="button">The button to populate.</param>
        /// <param name="upgrade">The upgrade to load it with.</param>
        /// <param name="price">The price to load it with.</param>
        public void LoadButton(ShopButtonEntity button, UpgradeData upgrade, PriceData price)
        {
            var lTexture = this.TextureByPriceData[price];

            button.ID = upgrade.ID;
            button.NameText = upgrade.Text;
            button.Level = price.Level;
            button.LevelText = this.GetLevelText(upgrade, price);
            button.Description = price.Description;
            button.Price = price.Price;
            button.PriceText = this.GetPriceText(upgrade, price);
            button.Font = this.ButtonFont;
            button.BoldFont = this.ButtonFontBold;
            button.IconTexture = lTexture;
            button.IconSize = new Vector2(lTexture.Width, lTexture.Height);
        }