Esempio n. 1
0
        private StringBuilder buildComment(Entity entity, ItemsPackFromConfigComponent itemsPackFromConfig)
        {
            StringBuilder builder = new StringBuilder();

            if (itemsPackFromConfig.Pack.Count > 0)
            {
                int num = 0;
                builder.Append("* —");
                bool flag = true;
                foreach (long num2 in itemsPackFromConfig.Pack)
                {
                    ItemInMarketRequestEvent evt = new ItemInMarketRequestEvent();
                    this.SendEvent <ItemInMarketRequestEvent>(evt, entity);
                    if (evt.marketItems.ContainsKey(num2))
                    {
                        if (!flag)
                        {
                            builder.Append(", ");
                        }
                        flag = false;
                        builder.Append(evt.marketItems[num2]);
                        num++;
                    }
                }
                if (num == 0)
                {
                    builder.Append((string)this.specialOfferEmptyRewardMessage);
                }
            }
            return(builder);
        }
        private void UpdateElements(Entity entity)
        {
            SpecialOfferContentLocalizationComponent component = entity.GetComponent <SpecialOfferContentLocalizationComponent>();

            this.title.text = component.Title;
            SpecialOfferScreenLocalizationComponent component2 = entity.GetComponent <SpecialOfferScreenLocalizationComponent>();

            this.hurryUp.text     = component2.Footer;
            this.description.text = component2.Description;
            GoodsPriceComponent component3 = entity.GetComponent <GoodsPriceComponent>();

            this.newPrice.text = component3.Price + " " + component3.Currency;
            LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)this.newPrice.rectTransform.parent.parent);
            ItemsPackFromConfigComponent component4 = entity.GetComponent <ItemsPackFromConfigComponent>();
            CountableItemsPackComponent  component5 = entity.GetComponent <CountableItemsPackComponent>();
            XCrystalsPackComponent       component6 = entity.GetComponent <XCrystalsPackComponent>();
            CrystalsPackComponent        component7 = entity.GetComponent <CrystalsPackComponent>();
            List <long> itemIds = new List <long>(component4.Pack);

            itemIds.AddRange(component5.Pack.Keys);
            RequestInfoForItemsEvent evt = new RequestInfoForItemsEvent(itemIds);

            this.SendEvent <RequestInfoForItemsEvent>(evt, entity);
            this.AddMainItem(evt.mainItemTitle, (long)evt.mainItemCount, evt.mainItemSprite, false, ItemRarityType.COMMON);
            this.mainItemDescription.text = evt.mainItemDescription;
            foreach (long num in component5.Pack.Keys)
            {
                if (evt.mainItemId != num)
                {
                    string title     = evt.titles[num];
                    string spriteUid = evt.previews[num];
                    this.AddItem(title, (long)component5.Pack[num], this.previewContainer.transform, spriteUid, evt.rarityFrames[num], evt.rarities[num]);
                }
            }
            foreach (long num3 in component4.Pack)
            {
                if (evt.mainItemId != num3)
                {
                    string title     = evt.titles[num3];
                    string spriteUid = evt.previews[num3];
                    this.AddItem(title, 0L, this.previewContainer.transform, spriteUid, evt.rarityFrames[num3], evt.rarities[num3]);
                }
            }
            if ((component7.Total > 0L) && !evt.mainItemCrystal)
            {
                this.AddItem(evt.crystalTitle, component7.Total, this.previewContainer.transform, evt.crystalSprite, false, ItemRarityType.COMMON);
            }
            if (((component6.Amount + component6.Bonus) > 0L) && !evt.mainItemXCrystal)
            {
                this.AddItem(evt.xCrystalTitle, component6.Amount + component6.Bonus, this.previewContainer.transform, evt.xCrystalSprite, false, ItemRarityType.COMMON);
            }
        }
Esempio n. 3
0
        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);
            }
        }