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