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}"); }
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); }