protected override void FillFromEntity(Entity entity) { GoodsPriceComponent component = entity.GetComponent <GoodsPriceComponent>(); if ((component.Currency != this.cachedCurrency) || (component.Price != this.cachedPrice)) { this.cachedCurrency = component.Currency; this.cachedPrice = component.Price; SpecialOfferContentLocalizationComponent component2 = entity.GetComponent <SpecialOfferContentLocalizationComponent>(); base.description.text = component2.Description; base.title.text = component2.Title; base.banner.SpriteUid = component2.SpriteUid; base.order = entity.GetComponent <OrderItemComponent>().Index; SpecialOfferContentComponent component3 = entity.GetComponent <SpecialOfferContentComponent>(); double price = component.Price; if (component3.SalePercent != 0) { this.oldPrice.gameObject.SetActive(false); this.saleImage.gameObject.SetActive(true); this.saleText.text = "-" + component3.SalePercent + "%"; } else { this.oldPrice.gameObject.SetActive(true); this.oldPrice.text = this.FormatPrice(price, this.cachedCurrency); price = component.Round((price * (100 - component3.SalePercent)) / 100.0); this.saleImage.gameObject.SetActive(false); } base.price.text = this.FormatPrice(price, this.cachedCurrency); if (component3.HighlightTitle) { base.title.faceColor = new Color32(0xff, 0xbc, 9, 0xff); this.titleStripes.gameObject.SetActive(true); } base.EndDate = entity.GetComponent <SpecialOfferEndTimeComponent>().EndDate; TextTimerComponent component4 = base.GetComponent <TextTimerComponent>(); component4.EndDate = base.EndDate; component4.enabled = true; ItemsPackFromConfigComponent itemsPackFromConfig = entity.GetComponent <ItemsPackFromConfigComponent>(); if (component3.ShowItemsList) { this.items.text = this.buildComment(entity, itemsPackFromConfig).ToString(); } else { Vector3 localPosition = this.timer.transform.localPosition; this.timer.transform.localPosition = new Vector3(localPosition.x, this.items.transform.localPosition.y, localPosition.z); this.items.gameObject.SetActive(false); } base.FillFromEntity(entity); } }
public void SetBonusInactive() { this.button.interactable = false; this.goBackText.SetActive(true); base.EndDate = base.Entity.GetComponent <ExpireDateComponent>().Date; TextTimerComponent component = base.GetComponent <TextTimerComponent>(); component.EndDate = base.EndDate; component.ActiveWhenTimeIsUp = true; component.enabled = true; this.bottom.alpha = 0.2f; this.bannerImage.sprite = this.inactiveBonusSprite; }
protected override void FillFromEntity(Entity entity) { if (entity.HasComponent <ImageItemComponent>()) { string spriteUid = entity.GetComponent <ImageItemComponent>().SpriteUid; base.banner.SpriteUid = spriteUid; } base.title.text = MarketItemNameLocalization.Instance.GetCategoryName(entity) + " \""; GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(entity); if (item != null) { base.title.text = base.title.text + MarketItemNameLocalization.Instance.GetGarageItemName(item); } else if (entity.HasComponent <DescriptionItemComponent>()) { DescriptionItemComponent component = entity.GetComponent <DescriptionItemComponent>(); base.title.text = base.title.text + component.Name; } base.title.text = base.title.text + "\""; XPriceItemComponent component2 = entity.GetComponent <XPriceItemComponent>(); string priceStr = component2.Price.ToStringSeparatedByThousands(); if (component2.Price < component2.OldPrice) { priceStr = priceStr + $" <s><#{this.greyColor.Color.ToHexString()}>{component2.OldPrice.ToStringSeparatedByThousands()}</color></s>"; } this.SetPrice(priceStr, "<sprite=9>"); base.EndDate = entity.GetComponent <MarketItemSaleComponent>().endDate; if (base.EndDate.UnityTime != 0f) { TextTimerComponent component = base.GetComponent <TextTimerComponent>(); component.EndDate = base.EndDate; component.enabled = true; } base.FillFromEntity(entity); }