internal void UpdateItemSelected(GameTime gameTime, IPageItem item) { if (item.CanGift()) { present.Update(gameTime); } else { presentDisabled.Update(gameTime); presentDisabledText.SetText(RetroEnvironment.GetLanguageManager().TryGetValue(presentDisabledText.GetOriginalText())); presentDisabledText.Update(gameTime); } buy.Update(gameTime); Amount.SetText(RetroEnvironment.GetLanguageManager().TryGetValue(Amount.GetOriginalText())); Price.SetText(RetroEnvironment.GetLanguageManager().TryGetValue(Price.GetOriginalText())); amountText.SetText("10"); amountText.Update(gameTime); Amount.Update(gameTime); Price.Update(gameTime); priceOneText.SetText((item.GetPrices()[0] * int.Parse(amountText.GetText())).ToString()); priceTwoText.SetText("+ " + (item.GetPrices()[1] * int.Parse(amountText.GetText())).ToString()); priceOneText.Update(gameTime); priceTwoText.Update(gameTime); }
internal void UpdatePosition(Vector2i position, out int bodySize) { this.localPosition = position; bodySize = size.Y; icon.SetPosition(position + new Vector2i(53 / 2 - icon.dimensions.X / 2, 38 / 2 - icon.dimensions.Y / 2)); Font priceOne = headerF[0]; priceOne.SetText(item.GetPrices()[0].ToString()); priceOne.SetPosition(position + new Vector2i(34 - priceOne.measureString().X, 41 + ((11 / 2) - (priceOne.measureString().Y / 2)))); switch (item.GetPricesTypes()[0]) { case PriceTypes.CREDITS: smallCredit.SetPosition(position + new Vector2i(37, 41 + ((11 / 2) - (smallCredit.GetTexture().Height / 2)))); break; case PriceTypes.DUCKETS: smallDucket.SetPosition(position + new Vector2i(37, 41 + ((11 / 2) - (smallCredit.GetTexture().Height / 2)))); break; case PriceTypes.DIAMONDS: smallDiamond.SetPosition(position + new Vector2i(37, 41 + ((11 / 2) - (smallCredit.GetTexture().Height / 2)))); break; case PriceTypes.GOTW: smallGotw.SetPosition(position + new Vector2i(37, 41 + ((11 / 2) - (smallCredit.GetTexture().Height / 2)))); break; } if (item.IsDubbelPriced()) { Font priceTwo = headerF[1]; priceTwo.SetText("+ " + item.GetPrices()[1].ToString()); priceTwo.SetPosition(position + new Vector2i(34 - priceTwo.measureString().X, 55 + ((11 / 2) - (priceTwo.measureString().Y / 2)))); switch (item.GetPricesTypes()[1]) { case PriceTypes.DUCKETS: smallDucket.SetPosition(position + new Vector2i(37, 55 + ((11 / 2) - (smallCredit.GetTexture().Height / 2)))); break; case PriceTypes.DIAMONDS: smallDiamond.SetPosition(position + new Vector2i(37, 55 + ((11 / 2) - (smallCredit.GetTexture().Height / 2)))); break; case PriceTypes.GOTW: smallGotw.SetPosition(position + new Vector2i(37, 55 + ((11 / 2) - (smallCredit.GetTexture().Height / 2)))); break; } } UploadTextures(); }
public CataItemSection(ContentManager content, int pageId, IPageItem item, Vector2i position, Vector2i size, out int bodySize) { images = new List <Image>(); fonts = new List <Font>(); headerT = new List <Image>(); headerF = new List <Font>(); this.size = size; this.localPosition = position; this.item = item; this.pageId = pageId; delay = new Timer(200); delay.Elapsed += Delay_Elapsed; #region Section Header String classname = String.Empty; if (GameScreenManager.Instance.GetFurniTypeBySpriteId(item.GetSpriteId()) != null) { classname = GameScreenManager.Instance.GetFurniTypeBySpriteId(item.GetSpriteId()).classname; } Logger.Debug("Generating header for:", classname); if (classname != String.Empty) { if (File.Exists(@"Content/Client/Items/" + classname + "/icon.xnb")) { GameScreenManager.Instance.GetCatalogusManager().catalogusImageManager.GetFurniIcon(classname, out icon); } else { icon = new Image(content, @"Client/Items/CantFindTextureTextures/item_small", Vector2.Zero); } } else { icon = new Image(content, @"Client/Items/CantFindTextureTextures/item_small", Vector2.Zero); } icon.SetPosition(position + new Vector2i(size.X / 2 - icon.dimensions.X / 2, size.Y / 2 - icon.dimensions.Y / 2)); headerT.Add(icon); smallCredit = new Image(content, @"Menu/Catalogus/Items/Small/credits", Vector2.Zero); smallDiamond = new Image(content, @"Menu/Catalogus/Items/Small/diamonds", Vector2.Zero); smallDucket = new Image(content, @"Menu/Catalogus/Items/Small/duckets", Vector2.Zero); smallGotw = new Image(content, @"Menu/Catalogus/Items/Small/gotw", Vector2.Zero); Font priceOne = new Font(content, "Fonts/Catalogus/CurrencyTitle", item.GetPrices()[0].ToString(), new Color(11, 11, 11)); //125, 216, 246 priceOne.SetPosition(position + new Vector2i(34 - priceOne.measureString().X, 41 + ((11 / 2) - (priceOne.measureString().Y / 2)))); headerF.Add(priceOne); Font priceTwo = new Font(content, "Fonts/Catalogus/CurrencyTitle", "+ 0", new Color(11, 11, 11)); //125, 216, 246 priceTwo.SetPosition(position + new Vector2i(34 - priceTwo.measureString().X, 55 + ((11 / 2) - (priceOne.measureString().Y / 2)))); switch (item.GetPricesTypes()[0]) { case PriceTypes.CREDITS: headerT.Add(smallCredit); break; case PriceTypes.DUCKETS: headerT.Add(smallDucket); break; case PriceTypes.DIAMONDS: headerT.Add(smallDiamond); break; case PriceTypes.GOTW: headerT.Add(smallGotw); break; default: Logger.Error("Unknown price type:", item.GetPricesTypes()[0].ToString()); break; } if (item.IsDubbelPriced()) { headerF.Add(priceTwo); switch (item.GetPricesTypes()[1]) { case PriceTypes.DUCKETS: headerT.Add(smallDucket); break; case PriceTypes.DIAMONDS: headerT.Add(smallDiamond); break; case PriceTypes.GOTW: headerT.Add(smallGotw); break; default: Logger.Error("Unknown price type:", item.GetPricesTypes()[1].ToString()); break; } } #endregion bodySize = size.Y; }