Inheritance: UnityEngine.MonoBehaviour
        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);
        }
        protected override void UpdateCustomAmount(CustomVirtCurrAmountController.CustomAmountCalcRes pRes)
        {
            // find custom amount controller
            CustomVirtCurrAmountController controller = FindObjectOfType <CustomVirtCurrAmountController>();

            if (controller != null)
            {
                controller.setValues(pRes);
            }
            else
            {
                Logger.Log("Custom amount controller not found");
            }
        }
Ejemplo n.º 3
0
        public void init(XsollaUtils pUtils)
        {
            mUtils     = pUtils;
            mListItems = new List <PricePointItemController>();

            mStartProgressBar();

            mShopTitle.text = (pUtils.GetProject().components ["virtual_currency"].Name != "") ? pUtils.GetProject().components["virtual_currency"].Name : pUtils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_TITLE);

            // Задаем перевод на отсутствие товаров
            mEmptyLabel.text = mUtils.GetTranslations().Get("virtualitem_no_data");
            mEmptyLabel.gameObject.SetActive(false);

            // Возможность произвольной покупки
            if (mUtils.GetSettings().components.virtualCurreny.customAmount)
            {
                mCustomAmountLink.SetActive(true);
                mCustomController = mCustomAmountScreen.GetComponent <CustomVirtCurrAmountController>();
                mCustomAmountLink.GetComponent <Button>().onClick.AddListener(ChangeStateCusomAmount);
                StateCustomAmount = false;
            }
            else
            {
                mCustomAmountLink.SetActive(false);
                StateCustomAmount = false;
            }

            // получить список пакетов
            Dictionary <String, object> lParams = new Dictionary <string, object>();

            lParams.Add(XsollaApiConst.ACCESS_TOKEN, mUtils.GetAcceessToken());
            if (mUtils.GetUser().userBalance != null)
            {
                lParams.Add(XsollaApiConst.USER_INITIAL_CURRENCY, mUtils.GetUser().userBalance.currency);
            }
            ApiRequest.Instance.getApiRequest(new XsollaRequestPckg(mPricePointsUrl, lParams), PricePointsRecived, ErrorRecived);
        }
Ejemplo n.º 4
0
 protected virtual void OnCustomAmountResRecieved(CustomVirtCurrAmountController.CustomAmountCalcRes pRes)
 {
     if (CustomAmountCalcRecieved != null)
         CustomAmountCalcRecieved(pRes);
 }
 protected override void UpdateCustomAmount(CustomVirtCurrAmountController.CustomAmountCalcRes pRes)
 {
     // find custom amount controller
     CustomVirtCurrAmountController controller = FindObjectOfType<CustomVirtCurrAmountController>();
     if (controller != null)
         controller.setValues(pRes);
     else
         Logger.Log("Custom amount controller not found");
 }