FormatPrice() public static méthode

public static FormatPrice ( string currency, string amount ) : string
currency string
amount string
Résultat string
 public string GetPriceString()
 {
     if (!IsVirtualPayment())
     {
         if (amount == amountWithoutDiscount)
         {
             return(CurrencyFormatter.FormatPrice(currency, amount.ToString()));
         }
         else
         {
             string oldPrice = CurrencyFormatter.FormatPrice(currency, amountWithoutDiscount.ToString());
             string newPrice = CurrencyFormatter.FormatPrice(currency, amount.ToString());
             return("<size=10><color=#a7a7a7>" + oldPrice + "</color></size>" + " " + newPrice);
         }
     }
     else
     {
         if (vcAmount == vcAmountWithoutDiscount)
         {
             // FIX name currency must by localizated
             return(CurrencyFormatter.FormatPrice(virtCurrency, vcAmount.ToString()));
         }
         else
         {
             string oldPrice = CurrencyFormatter.FormatPrice(virtCurrency, vcAmountWithoutDiscount.ToString());
             string newPrice = CurrencyFormatter.FormatPrice(virtCurrency, vcAmount.ToString());
             return("<size=10><color=#a7a7a7>" + oldPrice + "</color></size>" + " " + newPrice);
         }
     }
 }
Exemple #2
0
        public void setValues(CustomAmountCalcRes pValue)
        {
            mSetValues = true;
            if (pValue.amount != 0)
            {
                totalAmountTitle.text = mTotalTitle + " " + CurrencyFormatter.FormatPrice(pValue.currency, pValue.amount.ToString("N2"));
            }
            else
            {
                totalAmountTitle.text = "";
            }

            if (pValue.vcAmount != 0)
            {
                virtCurrAmount.text = pValue.vcAmount.ToString();
            }
            else
            {
                virtCurrAmount.text = "";
            }

            if (pValue.amount != 0)
            {
                realCurrAmount.text = pValue.amount.ToString("0.00");
            }
            else
            {
                realCurrAmount.text = "";
            }

            if (pValue.currency == "USD")
            {
                iconRealCurr.text = "$";
            }
            else if (pValue.currency == "EUR")
            {
                iconRealCurr.text = "€";
            }
            else if (pValue.currency == "RUB")
            {
                iconRealCurr.text = "";
            }

            if (pValue.vcAmount > 0)
            {
                btnPay.interactable = true;
            }
            else
            {
                btnPay.interactable = false;
            }

            mSetValues = false;
        }
Exemple #3
0
 public string GetPriceString()
 {
     if (sum == sumWithoutDiscount)
     {
         return(CurrencyFormatter.FormatPrice(currency, sum.ToString()));
     }
     else
     {
         string oldPrice = CurrencyFormatter.FormatPrice(currency, sumWithoutDiscount.ToString());
         string newPrice = CurrencyFormatter.FormatPrice(currency, sum.ToString());
         return("<size=10><color=#a7a7a7>" + oldPrice + "</color></size>" + " " + newPrice);
     }
 }
 public string GetPriceString()
 {
     if (!IsSpecial())
     {
         return(CurrencyFormatter.FormatPrice(chargeCurrency, chargeAmount.ToString()));
     }
     else
     {
         string oldPrice = CurrencyFormatter.FormatPrice(chargeCurrency, chargeAmountWithoutDiscount.ToString());
         string newPrice = CurrencyFormatter.FormatPrice(chargeCurrency, chargeAmount.ToString());
         return("<size=10><color=#a7a7a7>" + oldPrice + "</color></size>" + " " + newPrice);
     }
 }
        public void Init(XsollaTranslations pTranslation, XsollaHistoryItem pItem, String pVirtCurrName, Boolean pEven, Action pSortAction, Boolean pHeader = false, Boolean pDesc = true)
        {
            Image imgComp = this.GetComponent <Image>();

            imgComp.enabled = pEven;

            if (pHeader)
            {
                mDate.text = pTranslation.Get("balance_history_date") + (pDesc == true?" ▼":" ▲");
                Button sortBtn = mDate.gameObject.AddComponent <Button>();
                sortBtn.onClick.AddListener(delegate
                {
                    Logger.Log("On sort btn click");
                    pSortAction();
                    mDate.text = pTranslation.Get("balance_history_date") + " ↓";
                });

                mType.text       = pTranslation.Get("balance_history_purpose");
                mItem.text       = pTranslation.Get("balance_history_item");
                mBalance.text    = pTranslation.Get("balance_history_vc_amount");
                mPrice.text      = pTranslation.Get("balance_history_payment_amount");
                mPrice.alignment = TextAnchor.LowerLeft;

                // Activate devider
                mDevider.SetActive(true);
                LayoutElement layout = this.transform.GetComponent <LayoutElement>();
                layout.minHeight = 30;
                return;
            }

            //mDate.text = pItem.date.ToShortDateString();
            mDate.text = pItem.date.ToString("MMM d, yyyy hh:mm tt");
            // balance_history_payment_info:"Payment via {{paymentName}}, transaction ID {{transactionId}}"
            // balance_history_payment_info_cancellation:"Refund. Payment via {{paymentName}}, transaction ID {{transactionId}}"
            // balance_history_subscription_change:"Subscription change. Payment via {{paymentName}}, transaction ID: {{transactionId}} "
            // balance_history_subscription_create:"Subscription create. Payment via {{paymentName}}, transaction ID {{transactionId}}"
            // balance_history_subscription_renew:"Subscription renewal. Payment via {{paymentName}}, transaction ID: {{transactionId}} "
            // balance_history_ingame_info:"In-Game Purchase"
            // balance_history_internal_info:"{{comment}}"
            // balance_history_coupon_info:"Coupon, code {{code}}"
            // subscription_cancellation:"Subscription cancellation"

            switch (pItem.operationType)
            {
            case "payment":
            {
                mType.text = String.Format(prepareTypeStr(pTranslation.Get("balance_history_payment_info")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            case "cancellation":
            {
                mType.text = String.Format(prepareTypeStr(pTranslation.Get("balance_history_payment_info_cancellation")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            case "inGamePurchase":
            {
                mType.text = String.Format(prepareTypeStr(pTranslation.Get("balance_history_ingame_info")));
                break;
            }

            case "internal":
            {
                mType.text = String.Format(prepareTypeStr(pTranslation.Get("balance_history_internal_info")), pItem.comment);
                break;
            }

            case "coupon":
            {
                mType.text = String.Format(prepareTypeStr(pTranslation.Get("balance_history_coupon_info")), pItem.couponeCode);
                break;
            }

            case "subscriptionRenew":
            {
                mType.text = String.Format(prepareTypeStr(pTranslation.Get("balance_history_subscription_renew")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            case "subscriptionCreate":
            {
                mType.text = String.Format(prepareTypeStr(pTranslation.Get("balance_history_subscription_create")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            case "subscriptionChange":
            {
                mType.text = String.Format(prepareTypeStr(pTranslation.Get("balance_history_subscription_change")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            case "subscriptionCancellation":
            {
                mType.text = String.Format(prepareTypeStr(pTranslation.Get("subscription_cancellation")), pItem.paymentName, pItem.invoiceId);
                break;
            }

            default:
            {
                mType.text = "";
                break;
            }
            }

            if (pItem.virtualItems.items.GetCount() != 0)
            {
                mItem.text = pItem.virtualItems.items.GetItemByPosition(0).GetName();
            }

            if (pItem.vcAmount != 0)
            {
                mBalance.text = ((pItem.vcAmount > 0)?"+":"") + pItem.vcAmount + " " + pVirtCurrName + "\n" + "(=" + pItem.userBalance + " " + pVirtCurrName + ")";
            }
            else
            {
                mBalance.text = "";
            }

            if (pItem.paymentAmount != 0)
            {
                mPrice.text = CurrencyFormatter.FormatPrice(pItem.paymentCurrency, pItem.paymentAmount.ToString("0.00"));
                if (pItem.paymentCurrency == "RUB")
                {
                    mSymbolRub.SetActive(true);
                }
                else
                {
                    mSymbolRub.SetActive(false);
                    mPrice.alignment = TextAnchor.LowerLeft;
                }
            }
            else
            {
                mPrice.text = "";
            }
        }