/// <summary> /// Gets the level text to display for the button with the given upgrade and price data. /// </summary> /// <param name="upgrade">The upgrade data.</param> /// <param name="price">The price data.</param> /// <returns>An appropriately formatted string.</returns> private string GetLevelText(UpgradeData upgrade, PriceData price) { var lLevel = price.Level; var lLevelMax = upgrade.Prices.Count - 1; if (lLevel > lLevelMax) return "ALREADY"; else return string.Format("Level {0}/{1}", price.Level - 1, upgrade.Prices.Count - 1); }
/// <summary> /// Gets the appropriate private text to display for the button with the given upgrade and price data. /// </summary> /// <param name="upgrade">The upgrade data.</param> /// <param name="price">The price data.</param> /// <returns>An appropriately formatted string.</returns> private string GetPriceText(UpgradeData upgrade, PriceData price) { var lLevel = price.Level; var lLevelMax = upgrade.Prices.Count - 1; if (lLevel > lLevelMax) return "MAXED"; else return string.Format("{0} Honeycomb", price.Price); }
/// <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); }