public void OpenPricepoints(string title, XsollaPricepointsManager pricepoints, string virtualCurrencyName, string buyBtnText, bool pCustomHref = false, XsollaUtils pUtils = null)
        {
            Resizer.ResizeToParrent(gameObject);
            menu.transform.parent.parent.gameObject.SetActive(false);
            SetTitle(title);
            // if we have custom amount we need show link object
            if (pCustomHref)
            {
                CustomAmountLink.SetActive(true);
                string customAmountShowTitle = pUtils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_CUSTOM_AMOUNT_SHOW_TITLE);
                string customAmountHideTitle = pUtils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_CUSTOM_AMOUNT_HIDE_TITLE);

                Text titleCustomAmount = CustomAmountLink.GetComponent <Text>();
                titleCustomAmount.text = customAmountShowTitle;

                Toggle toggle = CustomAmountLink.GetComponent <Toggle>();
                toggle.onValueChanged.AddListener((value) =>
                {
                    if (value)
                    {
                        titleCustomAmount.text = customAmountHideTitle;
                    }
                    else
                    {
                        titleCustomAmount.text = customAmountShowTitle;
                    }

                    CustomAmountScreen.SetActive(value);
                    ShopPanel.SetActive(!value);

                    Logger.Log("Change value toggle " + value.ToString());
                });

                CustomVirtCurrAmountController controller = CustomAmountScreen.GetComponent <CustomVirtCurrAmountController>() as CustomVirtCurrAmountController;
                controller.initScreen(pUtils, pricepoints.GetItemByPosition(1).currency, CalcCustomAmount, TryPayCustomAmount);
            }
            else
            {
                CustomAmountLink.SetActive(false);
            }

            pAdapter.SetManager(pricepoints, virtualCurrencyName, buyBtnText);
            if (pAdapter.OnBuyPricepoints == null)
            {
                pAdapter.OnBuyPricepoints += (outAmount) => {
                    Dictionary <string, object> map = new Dictionary <string, object> (1);
                    map.Add("out", outAmount);
                    OpenPaymentMethods(map, false);
                };
            }
            DrawContent(pAdapter, 3);
        }
Пример #2
0
 public XsollaPricepoint GetItem(int position)
 {
     return(manager.GetItemByPosition(position));
 }