コード例 #1
0
        public static string FormatItem(Entity item, Entity method = null)
        {
            string         str       = string.Empty;
            GoodsComponent component = item.GetComponent <GoodsComponent>();

            if (item.HasComponent <SpecialOfferContentLocalizationComponent>())
            {
                str = item.GetComponent <SpecialOfferContentLocalizationComponent>().Title + " ";
            }
            else if (item.HasComponent <XCrystalsPackComponent>())
            {
                XCrystalsPackComponent component3 = item.GetComponent <XCrystalsPackComponent>();
                str = ("<#" + instance.xCrystalsColor.Color.ToHexString() + ">") + ((long)(((long)(component.SaleState.AmountMultiplier * component3.Amount)) + component3.Bonus)).ToStringSeparatedByThousands() + "<sprite=9></color>";
            }
            GoodsPriceComponent component4 = item.GetComponent <GoodsPriceComponent>();
            double price = component4.Price;

            if (!item.HasComponent <SpecialOfferComponent>())
            {
                price = component4.Round(component.SaleState.PriceMultiplier * component4.Price);
            }
            else if (item.HasComponent <CustomOfferPriceForUIComponent>())
            {
                price = item.GetComponent <CustomOfferPriceForUIComponent>().Price;
            }
            return(str + $" {instance.forText.Value} {price.ToStringSeparatedByThousands()} {component4.Currency}");
        }
コード例 #2
0
        public void Show(Entity item, Entity method, string transaction, string phoneNumber, Action onForward)
        {
            this.SetPhoneNumber(phoneNumber);
            this.SetTransactionNumber(transaction);
            GoodsPriceComponent component  = item.GetComponent <GoodsPriceComponent>();
            GoodsComponent      component2 = item.GetComponent <GoodsComponent>();
            bool   flag       = item.HasComponent <SpecialOfferComponent>();
            string methodName = method.GetComponent <PaymentMethodComponent>().MethodName;
            double price      = component.Price;

            price = !flag?component.Round(component2.SaleState.PriceMultiplier *price) : item.GetComponent <SpecialOfferComponent>().GetSalePrice(price);

            if (item.HasComponent <XCrystalsPackComponent>())
            {
                XCrystalsPackComponent component3 = item.GetComponent <XCrystalsPackComponent>();
                long amount = component3.Amount;
                if (!flag)
                {
                    amount = (long)Math.Round((double)(component2.SaleState.AmountMultiplier * amount));
                }
                this.SetCrystalsAmount(amount + component3.Bonus);
            }
            this.SetPrice(price, component.Currency);
            MainScreenComponent.Instance.OverrideOnBack(new Action(this.Proceed));
            this.onForward = onForward;
            base.gameObject.SetActive(true);
        }
コード例 #3
0
        public void UpdateData()
        {
            string text;

            if (!this.Entity.HasComponent <PaymentGiftComponent>())
            {
                this.giftLabel.SetActive(false);
            }
            else
            {
                PaymentGiftComponent component = this.Entity.GetComponent <PaymentGiftComponent>();
                Platform.Kernel.ECS.ClientEntitySystem.API.Entity marketItem = Flow.Current.EntityRegistry.GetEntity(component.Gift);
                this.giftPreview.SpriteUid = marketItem.GetComponent <ImageItemComponent>().SpriteUid;
                this.giftLabel.SetActive(true);
                this.giftPreview.GetComponent <TooltipShowBehaviour>().TipText = MarketItemNameLocalization.GetFullItemDescription(marketItem, (string)this._commonString, (string)this._rareString, (string)this._epicString, (string)this._legendaryString);
            }
            XCrystalsPackComponent component2 = this.Entity.GetComponent <XCrystalsPackComponent>();
            SaleState saleState = this.Entity.GetComponent <GoodsComponent>().SaleState;
            string    str       = "<b>  ";
            long      amount    = component2.Amount;
            long      num2      = (long)Math.Round((double)(component2.Amount * saleState.AmountMultiplier));
            long      bonus     = component2.Bonus;

            if (saleState.AmountMultiplier <= 1.0)
            {
                str = str + amount.ToStringSeparatedByThousands();
                object[] objArray2 = new object[] { ((long)(amount + bonus)).ToStringSeparatedByThousands(), "<sprite=", this.xCrySpriteIndex, ">" };
                this.totalAmount.text = string.Concat(objArray2);
            }
            else
            {
                str = str + num2.ToStringSeparatedByThousands() + $" <s><#{this.greyColor.Color.ToHexString()}>{amount.ToStringSeparatedByThousands()}</color></s>";
                this.totalAmount.text = ((long)(num2 + bonus)).ToStringSeparatedByThousands();
                this.totalAmount.text = this.totalAmount.text + $" <s><#{this.greyColor.Color.ToHexString()}>{((long) (amount + bonus)).ToStringSeparatedByThousands()}</color></s>";
                text = this.totalAmount.text;
                object[] objArray1 = new object[] { text, "<sprite=", this.xCrySpriteIndex, ">" };
                this.totalAmount.text = string.Concat(objArray1);
            }
            text = str;
            object[] objArray3 = new object[] { text, "</b><sprite=", this.xCrySpriteIndex, ">\n" };
            str = string.Concat(objArray3);
            str = (bonus <= 0L) ? (str + "\n") : (str + string.Format("<size=17><#{2}>+{0} {1}<sprite=" + this.xCrySpriteIndex + "></color>", bonus.ToStringSeparatedByThousands(), this.forFree.Value, this.greyColor.Color.ToHexString()));
            this.amount.text = str;
            GoodsPriceComponent component4 = this.Entity.GetComponent <GoodsPriceComponent>();

            str = component4.Round(this.Entity.GetComponent <GoodsComponent>().SaleState.PriceMultiplier *component4.Price).ToStringSeparatedByThousands();
            if (saleState.PriceMultiplier < 1.0)
            {
                str = str + $" <s><#{this.greyColor.Color.ToHexString()}>{component4.Price.ToStringSeparatedByThousands()}</color></s>";
            }
            str             = str + " " + component4.Currency;
            this.price.text = str;
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
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);
            }
        }
コード例 #6
0
 public void InitiateScreen(GoodsPriceComponent offerGoodsPrice, DiscountComponent personalOfferDiscount, RentTankRole tankRole, ShopDialogs shopDialogs)
 {
     base.shopDialogs = shopDialogs;
     if (personalOfferDiscount.DiscountCoeff <= 0f)
     {
         this.actualPrice.text = offerGoodsPrice.Price + " " + offerGoodsPrice.Currency;
         this.SetDiscountObjects(false);
     }
     else
     {
         float num = this.RoundPrice(offerGoodsPrice.Price * (1f - personalOfferDiscount.DiscountCoeff));
         this.actualPrice.text          = num + " " + offerGoodsPrice.Currency;
         this.priceWithoutDiscount.text = offerGoodsPrice.Price.ToString(CultureInfo.InvariantCulture);
         this.discount.text             = $"-{personalOfferDiscount.DiscountCoeff * 100f}%";
         this.SetDiscountObjects(true);
     }
     this.SetWindowContent(tankRole);
 }
コード例 #7
0
 public void UpdateGoodsPrice(UpdateGoodsPriceEvent e, GoodsNode goods)
 {
     if (goods.Entity.HasComponent <GoodsPriceComponent>())
     {
         GoodsPriceComponent component = goods.Entity.GetComponent <GoodsPriceComponent>();
         component.Currency = e.Currency;
         component.Price    = e.Price;
     }
     else
     {
         GoodsPriceComponent component = new GoodsPriceComponent {
             Currency = e.Currency,
             Price    = e.Price
         };
         goods.Entity.AddComponent(component);
     }
     if (goods.Entity.HasComponent <SpecialOfferComponent>())
     {
         goods.Entity.GetComponent <SpecialOfferComponent>().Discount = e.DiscountCoeff * 100f;
     }
     base.ScheduleEvent <GoodsChangedEvent>(goods.Entity);
 }