コード例 #1
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);
        }
コード例 #2
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}");
        }
コード例 #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);
            }
        }