public void initScreen(XsollaUtils pUtils, string pCustomCurrency, Action<Dictionary<string, object>> pActionCalc, Action<float> pTryPay) { if (pUtils.GetProject().isDiscrete) virtCurrAmount.contentType = InputField.ContentType.IntegerNumber; else virtCurrAmount.contentType = InputField.ContentType.DecimalNumber; // Set btn Name btnPay.gameObject.GetComponentInChildren<Text>().text = pUtils.GetTranslations().Get("form_continue"); mTotalTitle = pUtils.GetTranslations().Get("payment_summary_total"); mCustomCurrency = pCustomCurrency; ImageLoader imageLoader = FindObjectOfType<ImageLoader>(); Logger.Log("VirtIcon " + pUtils.GetProject().virtualCurrencyIconUrl); imageLoader.LoadImage(iconVirtCurr, "http:" + pUtils.GetProject().virtualCurrencyIconUrl); virtCurrAmount.onEndEdit.AddListener(delegate { if (!mSetValues) pActionCalc(GetParamsForCalc(true)); }); realCurrAmount.onEndEdit.AddListener(delegate { if (!mSetValues) pActionCalc(GetParamsForCalc(false)); }); btnPay.onClick.AddListener(delegate { pTryPay(GetOutAmount()); }); }
public void InitScreen(XsollaUtils utils) { utilsLink = utils; title.GetComponent<Text>().text = utilsLink.GetTranslations().Get(XsollaTranslations.SAVEDMETHOD_PAGE_TITLE); showQuickPaymentMethods.GetComponent<Text>().text = utilsLink.GetTranslations().Get(XsollaTranslations.PAYMENT_LIST_SHOW_QUICK); back.GetComponent<Text>().text = utilsLink.GetTranslations().Get(XsollaTranslations.BACK_TO_SPECIALS); }
public void InitScreen(XsollaUtils pUtils) { _utiliLink = pUtils; // Set titles _title.text = _utiliLink.GetTranslations().Get(XsollaTranslations.COUPON_PAGE_TITLE); _coupounNotif.text = _utiliLink.GetTranslations().Get(XsollaTranslations.COUPON_DESCRIPTION); _nameInputField.text = _utiliLink.GetTranslations().Get(XsollaTranslations.COUPON_CODE_TITLE); _inputFieldExample.text = _utiliLink.GetTranslations().Get(XsollaTranslations.COUPON_CODE_EXAMPLE); Text btnText = _btnApply.GetComponentInChildren<Text>(); btnText.text = _utiliLink.GetTranslations().Get(XsollaTranslations.COUPON_CONTROL_APPLY); }
public void OpenPricepoints(XsollaUtils utils, XsollaPricepointsManager pricepoints) { DrawShopScreen (); string title = utils.GetTranslations ().Get (XsollaTranslations.PRICEPOINT_PAGE_TITLE); string vcName = utils.GetProject ().virtualCurrencyName; string buyText = utils.GetTranslations ().Get (XsollaTranslations.VIRTUAL_ITEM_OPTION_BUTTON); if (utils.GetSettings().components.virtualCurreny.customAmount) _shopViewController.OpenPricepoints(title, pricepoints, vcName, buyText, true, utils); else _shopViewController.OpenPricepoints(title, pricepoints, vcName, buyText); }
private void DrawForm(XsollaUtils utils, XsollaForm form) { currentActive = ActiveScreen.PAYMENT; GameObject checkoutScreen = Instantiate(Resources.Load(PREFAB_SCREEN_CHECKOUT)) as GameObject; checkoutScreen.transform.SetParent(mainScreenContainer.transform); Resizer.SetDefScale(checkoutScreen); checkoutScreen.GetComponent <RectTransform> ().anchoredPosition = new Vector2(0, 0); //scroll.content = paymentScreen.GetComponent<RectTransform> (); mainScreenContainer.GetComponentInParent <ScrollRect> ().content = checkoutScreen.GetComponent <RectTransform> (); ScreenCheckoutController controller = checkoutScreen.GetComponent <ScreenCheckoutController> (); controller.InitScreen(utils, form); }
private void DrawVPSummary(XsollaUtils utils, XVirtualPaymentSummary summary) { _summary = summary; currentActive = ActiveScreen.VP_PAYMENT; GameObject statusScreen = Instantiate(Resources.Load(PREFAB_SCREEN_VP_SUMMARY)) as GameObject; statusScreen.transform.SetParent(mainScreenContainer.transform); Resizer.SetDefScale(statusScreen); statusScreen.GetComponent <RectTransform> ().anchoredPosition = new Vector2(0, 0); mainScreenContainer.GetComponentInParent <ScrollRect> ().content = statusScreen.GetComponent <RectTransform> (); ScreenVPController screenVpController = statusScreen.GetComponent <ScreenVPController> (); screenVpController.DrawScreen(utils, summary); }
private void LoadShop(XsollaUtils utils) { Logger.Log("Load Shop request"); XsollaPaystation2 paystation2 = utils.GetSettings().paystation2; if (paystation2.goodsAtFirst != null && paystation2.goodsAtFirst.Equals("1")) { LoadGoodsGroups(); } else if (paystation2.pricepointsAtFirst != null && paystation2.pricepointsAtFirst.Equals("1")) { LoadShopPricepoints(); } }
public void InitScreen(XsollaUtils pUtils) { // set title _titleProj.text = pUtils.GetProject().name; // user name _userName.text = pUtils.GetUser().GetName(); if (pUtils.GetUser().virtualCurrencyBalance != null) { GameObject obj = Instantiate(Resources.Load(PREFAB_VIEW_MENU_ITEM_EMPTY)) as GameObject; UserProfileBtnController controller = obj.GetComponentInChildren<UserProfileBtnController>(); controller.InitScreen("History", ShowHistory); obj.transform.SetParent(_btnDropDownObj.transform); } }
public void OpenPricepoints(XsollaUtils utils, XsollaPricepointsManager pricepoints) { DrawShopScreen(); string title = utils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_TITLE); string vcName = utils.GetProject().virtualCurrencyName; string buyText = utils.GetTranslations().Get(XsollaTranslations.VIRTUAL_ITEM_OPTION_BUTTON); if (utils.GetSettings().components.virtualCurreny.customAmount) { _shopViewController.OpenPricepoints(title, pricepoints, vcName, buyText, true, utils); } else { _shopViewController.OpenPricepoints(title, pricepoints, vcName, buyText); } }
public void InitScreen(XsollaUtils pUtils) { // set title _titleProj.text = pUtils.GetProject().name; // user name _userName.text = pUtils.GetUser().GetName(); if (pUtils.GetUser().virtualCurrencyBalance != null) { GameObject obj = Instantiate(Resources.Load(PREFAB_VIEW_MENU_ITEM_EMPTY)) as GameObject; UserProfileBtnController controller = obj.GetComponentInChildren <UserProfileBtnController>(); controller.InitScreen("History", ShowHistory); obj.transform.SetParent(_btnDropDownObj.transform); } }
protected override void RecieveUtils(XsollaUtils utils) { StyleManager.Instance.ChangeTheme(utils.GetSettings().GetTheme()); mainScreen = Instantiate(mainScreen); mainScreen.transform.SetParent(container.transform); mainScreen.SetActive(true); mainScreenContainer = mainScreen.GetComponentsInChildren <ScrollRect> ()[0].gameObject; menuTransform = mainScreen.GetComponentsInChildren <RectTransform> ()[8].transform; Resizer.ResizeToParrent(mainScreen); base.RecieveUtils(utils); InitHeader(utils); InitFooter(utils); if (utils.GetPurchase() == null || !utils.GetPurchase().IsPurchase()) { InitMenu(utils); } }
public void InitScreen(XsollaUtils utils, XsollaForm form) { XsollaTranslations translations = utils.GetTranslations (); Resizer.ResizeToParrent (gameObject); bool isPurchaseNull = utils.GetPurchase () == null; if (isPurchaseNull || !utils.GetPurchase ().IsPurchase () || !utils.GetPurchase ().IsPaymentSystem ()) { if(!isPurchaseNull) isPrevStepPaymentList = !utils.GetPurchase ().IsPaymentSystem (); paymentForm.OnClickBack += () => { Back ();}; } paymentForm.InitView (translations, form); if (form.GetSummary () != null) tower.InitView (translations, form.GetSummary ()); else tower.gameObject.SetActive (false); }
// новая инициализация public void init(XsollaUtils pUtils, XsollaPricepoint pDefPackage) { mUtils = pUtils; if (pUtils.GetProject().isDiscrete) { virtCurrAmount.contentType = InputField.ContentType.IntegerNumber; } else { virtCurrAmount.contentType = InputField.ContentType.DecimalNumber; } btnPay.gameObject.GetComponentInChildren <Text>().text = pUtils.GetTranslations().Get("form_continue"); FindObjectOfType <ImageLoader>().LoadImage(iconVirtCurr, pUtils.GetProject().virtualCurrencyIconUrl); // Задаем дефолтное значение для обсчета totalAmountTitle.text = mUtils.GetTranslations().Get("form_subtotal"); virtCurrAmount.text = pDefPackage.outAmount.ToString(); realCurrAmount.text = pDefPackage.sum.ToString(); mTotalAmount.text = CurrencyFormatter.Instance.FormatPrice(pDefPackage.currency, pDefPackage.sum);; virtCurrAmount.onValueChanged.AddListener(delegate { if (!mSetValues) { CancelInvoke(); Invoke("RecalcVcAmount", 1); } }); virtCurrAmount.onEndEdit.AddListener(delegate { mErrorPanel.gameObject.SetActive(false); }); realCurrAmount.onValueChanged.AddListener(delegate { if (!mSetValues) { CancelInvoke(); Invoke("RecalcAmount", 1); } }); realCurrAmount.onEndEdit.AddListener(delegate { mErrorPanel.gameObject.SetActive(false); }); btnPay.onClick.AddListener(delegate { BuyBtn(); }); }
protected override void RecieveUtils(XsollaUtils utils) { StyleManager.Instance.ChangeTheme(utils.GetSettings().GetTheme()); mainScreen = Instantiate(mainScreen); mainScreen.transform.SetParent(container.transform); mainScreen.SetActive(true); mMainScreenController = mainScreen.GetComponent <MainScreenController>(); mainScreenContainer = mMainScreenController.mMainContainer; Resizer.ResizeToParrent(mainScreen); //base.RecieveUtils(utils); base.Utils = utils; InitHeader(utils); InitFooter(utils); InitNavMenu(utils); // Выделяем первый элемент mNavMenuController.onNavMenuItemClick(0); }
public void Init(XsollaUtils pUtils) { if (pUtils != null) { XsollaTranslations lTranslatrions = pUtils.GetTranslations(); mCustomerSupport.text = lTranslatrions.Get(XsollaTranslations.SUPPORT_CUSTOMER_SUPPORT); mContactUs.text = lTranslatrions.Get(XsollaTranslations.SUPPORT_CONTACT_US); mCopyRight.text = lTranslatrions.Get(XsollaTranslations.XSOLLA_COPYRIGHT); mSecuredConnection.text = lTranslatrions.Get(XsollaTranslations.FOOTER_SECURED_CONNECTION); mAgreement.text = pUtils.GetProject().eula != "null" ? pUtils.GetProject().eula : lTranslatrions.Get(XsollaTranslations.FOOTER_AGREEMENT); mAgreement.gameObject.GetComponent <Button>().onClick.AddListener(delegate { new OpenUrlHelper().OpenUrl(pUtils.GetProject().eulaUrl != "null" ? pUtils.GetProject().eulaUrl : mUrl); }); } }
public void DrawScreen(XsollaUtils utils, XVirtualPaymentSummary summary) { ResizeToParent(); Title.text = utils.GetTranslations().Get("cart_page_title"); Confirmation.text = utils.GetTranslations().Get("cart_confirm_your_purchase"); ImageLoader.UploadImageToCurrentView(summary.Items [0].GetImage()); ItemName.text = summary.Items [0].Name; BackTo.GetComponent <Text>().text = "< " + utils.GetTranslations().Get("back_to_virtualitem"); BackTo.GetComponent <Button>().onClick.AddListener(delegate { onClickBack(); }); ToggleText.text = utils.GetTranslations().Get("cart_dont_ask_again"); Total.text = utils.GetTranslations().Get("total") + " " + summary.Total + " " + utils.GetProject().virtualCurrencyName; ProceedButtonText.text = utils.GetTranslations().Get("cart_submit"); ProceedButton.onClick.AddListener(() => OnClickProceed()); }
protected override void ShowQuickPaymentsList(XsollaUtils utils, XsollaQuickPayments quickPayments) { InitPaymentListScreen(); if (!_paymentListScreenController.IsQuiqckPayments()) { _paymentListScreenController.InitScreen(utils); _paymentListScreenController.SetQuickPayments(quickPayments); // LoadPaymentMethods (); } else { _paymentListScreenController.UpdateQuick(quickPayments); } if (_paymentListScreenController.IsAllLoaded()) { SetLoading(false); } }
public void init(XsollaManagerSubDetails pSubDetail, XsollaUtils pUtils) { mTitle.text = pUtils.GetTranslations().Get("user_hold_subscription_title"); if (pSubDetail.mStatus != "non_renewing") { mDontRenewLabel.text = pUtils.GetTranslations().Get("hold_subscription_dont_renew_label"); mDontRenewDesc.text = pUtils.GetTranslations().Get("hold_subscription_dont_renew_label_description"); } else { mDontRenew.gameObject.SetActive(false); mDontRenewDesc.gameObject.SetActive(false); } mDeleteNowLabel.text = pUtils.GetTranslations().Get("hold_subscription_cancel_label"); mDeleteNowDesc.text = pUtils.GetTranslations().Get("hold_subscription_cancel_label_description"); }
/// <summary> /// Init the specified pUtils. /// </summary> /// <param name="pUtils">P utils.</param> public void Init(XsollaUtils pUtils) { mUtils = pUtils; mList = new List <HistoryElemController>(); mTitle.text = mUtils.GetTranslations().Get("balance_history_page_title"); mEmptyItems.text = mUtils.GetTranslations().Get("balance_history_no_data"); mBtnContinue.GetComponent <Text>().text = mUtils.GetTranslations().Get("balance_back_button"); mBtnContinue.GetComponent <Button>().onClick.AddListener(delegate { Destroy(); }); // Добавляем заголовок AddHeader(); // Делаем запрос на лист GetRequestList(); }
public void initScreen(XsollaUtils pUtils, string pCustomCurrency, Action <Dictionary <string, object> > pActionCalc, Action <float> pTryPay) { if (pUtils.GetProject().isDiscrete) { virtCurrAmount.contentType = InputField.ContentType.IntegerNumber; } else { virtCurrAmount.contentType = InputField.ContentType.DecimalNumber; } // Set btn Name btnPay.gameObject.GetComponentInChildren <Text>().text = pUtils.GetTranslations().Get("form_continue"); mTotalTitle = pUtils.GetTranslations().Get("payment_summary_total"); mCustomCurrency = pCustomCurrency; ImageLoader imageLoader = FindObjectOfType <ImageLoader>(); Logger.Log("VirtIcon " + pUtils.GetProject().virtualCurrencyIconUrl); imageLoader.LoadImage(iconVirtCurr, "http:" + pUtils.GetProject().virtualCurrencyIconUrl); virtCurrAmount.onEndEdit.AddListener(delegate { if (!mSetValues) { pActionCalc(GetParamsForCalc(true)); } }); realCurrAmount.onEndEdit.AddListener(delegate { if (!mSetValues) { pActionCalc(GetParamsForCalc(false)); } }); btnPay.onClick.AddListener(delegate { pTryPay(GetOutAmount()); }); }
public void DrawVpStatus(XsollaUtils utils, XVPStatus status) { XsollaTranslations translations = utils.GetTranslations(); string input; if (status.Status.HeaderDescription == null) { input = translations.Get(XsollaTranslations.STATUS_PURCHASED_DESCRIPTION); } else { input = status.Status.HeaderDescription; } XsollaStatus.Group currentStatus = status.GetGroup(); PrepareStatus(currentStatus, status.Status.Header, input, ""); AddTitle(utils.GetProject().name); AddStatus(status.Status.Description); AddElement(translations.Get("virtualstatus_check_operation"), status.OperationId); AddElement(translations.Get("virtualstatus_check_time"), string.Format("{0:dd/MM/yyyy HH:mm}", DateTime.Parse(status.OperationCreated))); if (status.Items.Count > 0) { AddElement(translations.Get("virtualstatus_check_virtual_items"), status.GetPurchase(0)); } if (status.vCurr.Count > 0) { AddElement(translations.Get("virtualstatus_check_virtual_currency"), status.GetVCPurchase(0) + " " + utils.GetProject().virtualCurrencyName); } if (status.OperationType != "coupon") { AddLine(); AddBigElement(translations.Get("virtualstatus_check_vc_amount"), status.VcAmount + " " + utils.GetProject().virtualCurrencyName); } statusViewExitButton.gameObject.GetComponent <Text> ().text = translations.Get(XsollaTranslations.BACK_TO_STORE); statusViewExitButton.onClick.AddListener(delegate { OnClickBack(currentStatus, status.OperationId, Xsolla.XsollaStatusData.Status.DONE, status.GetPurchaseList()); }); }
public void InitScreen(XsollaUtils pUtils) { _utiliLink = pUtils; // Set titles _title.text = _utiliLink.GetTranslations().Get(XsollaTranslations.COUPON_PAGE_TITLE); _coupounNotif.text = _utiliLink.GetTranslations().Get(XsollaTranslations.COUPON_DESCRIPTION); _nameInputField.text = _utiliLink.GetTranslations().Get(XsollaTranslations.COUPON_CODE_TITLE); _inputFieldExample.text = _utiliLink.GetTranslations().Get(XsollaTranslations.COUPON_CODE_EXAMPLE); _inputField.onValidateInput += delegate(string input, int charIndex, char addedChar) { return(MyValidate(addedChar)); }; _inputField.onEndEdit.AddListener(delegate { setAproveInput(); }); Text btnText = _btnApply.GetComponentInChildren <Text>(); btnText.text = _utiliLink.GetTranslations().Get(XsollaTranslations.COUPON_CONTROL_APPLY); }
private void InitMenu(XsollaUtils pUtils) { mRadioGroupController = mNavMenuPanel.gameObject.AddComponent <RadioGroupController> (); GameObject menuItemEmptyPrefab = Resources.Load(PREFAB_VIEW_MENU_ITEM_EMPTY) as GameObject; Dictionary <string, XComponent> components = pUtils.GetProject().components; if (components.ContainsKey("items") && components ["items"].IsEnabled) { string lName = (components ["items"].Name != "") ? components ["items"].Name : pUtils.GetTranslations().Get(XsollaTranslations.VIRTUALITEM_PAGE_TITLE); addMenuBtn("", lName, RadioButton.RadioType.SCREEN_GOODS); } if (components.ContainsKey("virtual_currency") && components ["virtual_currency"].IsEnabled) { string lName = (components ["virtual_currency"].Name != "") ? components["virtual_currency"].Name : pUtils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_TITLE); addMenuBtn("", lName, RadioButton.RadioType.SCREEN_PRICEPOINT); } if (components.ContainsKey("subscriptions") && components["subscriptions"].IsEnabled) { string lName = (components["subscriptions"].Name != "") ? components["subscriptions"].Name : pUtils.GetTranslations().Get("state_name_subscription"); addMenuBtn("", lName, RadioButton.RadioType.SCREEN_SUBSCRIPTION); } if (components.ContainsKey("coupons") && components["coupons"].IsEnabled) { string lName = (components["coupons"].Name != "") ? components["coupons"].Name : pUtils.GetTranslations().Get(XsollaTranslations.COUPON_PAGE_TITLE); addMenuBtn("", lName, RadioButton.RadioType.SCREEN_REDEEMCOUPON); } GameObject menuItemEmpty = Instantiate(menuItemEmptyPrefab); menuItemEmpty.transform.SetParent(mNavMenuPanel.transform); if (!pUtils.IsServerLess()) { addMenuBtn("", "", RadioButton.RadioType.SCREEN_FAVOURITE, true); } }
public void init(XsollaManagerSubDetails pSubDetail, XsollaUtils pUtils) { mUtils = pUtils; mSubDetail = pSubDetail; mListCharges = new List <GameObject>(); mPartTitle.text = mUtils.GetTranslations().Get("user_subscription_charges_title"); String lDateTitle = mUtils.GetTranslations().Get("virtualstatus_check_time"); String lPaymenyTypeTitle = mUtils.GetTranslations().Get("user_subscription_payment_header"); String lAmountTitle = mUtils.GetTranslations().Get("user_subscription_payment"); // добавляем заголовки addChargeElem(lDateTitle, lPaymenyTypeTitle, lAmountTitle, true); mSubDetail.mCharges.Sort(delegate(XsollaSubDetailCharge charge1, XsollaSubDetailCharge charge2) { if (charge1.mDateCreate < charge2.mDateCreate) { return(1); } else { return(-1); } }); mMorePanel.SetActive(mSubDetail.mCharges.Count > 4); mShowMoreBtn.onClick.AddListener(OnMoreBtnAction); // добавляем историю foreach (XsollaSubDetailCharge charge in mSubDetail.mCharges) { mListCharges.Add(addChargeElem(StringHelper.DateFormat(charge.mDateCreate), charge.mPaymentMethod, charge.mCharge.ToString())); } ShowList(mShowState); }
public void initScreen(XsollaUtils pUtils, XsollaManagerSubscriptions pSubsList) { mUtils = pUtils; mTitleScreen.text = mUtils.GetTranslations().Get("user_menu_user_subscription"); mContinueText.text = mUtils.GetTranslations().Get("balance_back_button"); mLabel.gameObject.SetActive(true); mLabel.text = mUtils.GetTranslations().Get("user_subscription_list_subtitle"); var children = new List <GameObject>(); foreach (Transform child in mSubsContainer.transform) { if (child.gameObject != mLabel.gameObject) { children.Add(child.gameObject); } } children.ForEach(child => Destroy(child)); setNotifyPanels(); // событие на кнопку возврата mContinueLink.onClick.RemoveAllListeners(); mContinueLink.onClick.AddListener(OnClickBackShopAction); if (pSubsList.GetCount() == 0) { Logger.Log("Empty List subs"); mLabel.text = mUtils.GetTranslations().Get("subscription_no_data"); mLabel.alignment = TextAnchor.MiddleCenter; } foreach (XsollaManagerSubscription sub in pSubsList.GetItemsList()) { addSubBtn(sub); } }
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); }
public void init(XsollaUtils pUtils) { mUtils = pUtils; mListItems = new List <ShopItemController>(); mGroupUseCached = new Dictionary <int, bool>(); // Задаем настройки на лэндинг mIsListLayout = pUtils.GetSettings().mDesktop.pVirtItems.isListLayout(); SetLanding(); // Задаем перевод на отсутствие товаров mEmptyLabel.text = mUtils.GetTranslations().Get("virtualitem_no_data"); mEmptyLabel.gameObject.SetActive(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(mGroupsUrl, lParams), GoodsGroupRecived, ErrorRecived); }
protected override void ShowPaymentForm(XsollaUtils utils, XsollaForm form) { Logger.Log ("Payment Form recived"); DrawForm (utils, form); SetLoading (false); }
public void InitScreen(XsollaUtils utils) { utilsLink = utils; showMore.GetComponent<Text>().text = utilsLink.GetTranslations().Get(XsollaTranslations.PAYMENT_LIST_SHOW_MORE); back.GetComponent<Text>().text = utilsLink.GetTranslations().Get(XsollaTranslations.BACK_TO_SPECIALS); }
private void InitTitle(XsollaUtils utils) { Text titleText = GetComponentInChildren <Text> (); titleText.text = utils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_TITLE); }
public void InitScreen(XsollaUtils utils) { DrawScreen(utils); }
public void InitScreen(XsollaUtils pUtils) { utilsLink = pUtils; back.GetComponent<Text>().text = utilsLink.GetTranslations().Get(XsollaTranslations.BACK_TO_LIST); }
protected override void ShowPricepoints(XsollaUtils utils, XsollaPricepointsManager pricepoints) { Logger.Log("Pricepoints recived"); OpenPricepoints(utils, pricepoints); SetLoading(false); }
private void DrawForm(XsollaUtils utils, XsollaForm form) { currentActive = ActiveScreen.PAYMENT; GameObject checkoutScreen = Instantiate (Resources.Load(PREFAB_SCREEN_CHECKOUT)) as GameObject; checkoutScreen.transform.SetParent(mainScreenContainer.transform); checkoutScreen.GetComponent<RectTransform> ().anchoredPosition = new Vector2 (0, 0); //scroll.content = paymentScreen.GetComponent<RectTransform> (); mainScreenContainer.GetComponentInParent<ScrollRect> ().content = checkoutScreen.GetComponent<RectTransform> (); ScreenCheckoutController controller = checkoutScreen.GetComponent<ScreenCheckoutController> (); controller.InitScreen(utils, form); }
private void DrawVPStatus(XsollaUtils utils, XVPStatus status) { currentActive = ActiveScreen.STATUS; menuTransform.gameObject.SetActive (false); GameObject statusScreen = Instantiate (Resources.Load(PREFAB_SCREEN_STATUS)) as GameObject; statusScreen.transform.SetParent(mainScreenContainer.transform); statusScreen.GetComponent<RectTransform> ().anchoredPosition = new Vector2 (0, 0); mainScreenContainer.GetComponentInParent<ScrollRect> ().content = statusScreen.GetComponent<RectTransform> (); StatusViewController controller = statusScreen.GetComponent<StatusViewController> (); controller.StatusHandler += OnUserStatusExit; controller.DrawVpStatus(utils, status); }
private void DrawVPSummary(XsollaUtils utils, XVirtualPaymentSummary summary) { _summary = summary; currentActive = ActiveScreen.VP_PAYMENT; menuTransform.gameObject.SetActive (true); GameObject statusScreen = Instantiate (Resources.Load(PREFAB_SCREEN_VP_SUMMARY)) as GameObject; statusScreen.transform.SetParent(mainScreenContainer.transform); statusScreen.GetComponent<RectTransform> ().anchoredPosition = new Vector2 (0, 0); mainScreenContainer.GetComponentInParent<ScrollRect> ().content = statusScreen.GetComponent<RectTransform> (); ScreenVPController screenVpController = statusScreen.GetComponent<ScreenVPController> (); screenVpController.DrawScreen(utils, summary); }
private void ProcessingRequestResult(int pType, RequestClass pRequestResult, Dictionary<string, object> pDataArgs) { if (!pRequestResult.HasError) { // Start Processing Debug.Log("Type -> " + pType); Debug.Log("WWW_request -> " + pRequestResult.TextRequest); JSONNode rootNode = JSON.Parse(pRequestResult.TextRequest); if(rootNode != null && rootNode.Count > 2 || rootNode["error"] == null) { switch(pType) { case TRANSLATIONS: { if(rootNode.Count > 2){ XsollaUtils utils = new XsollaUtils().Parse(rootNode) as XsollaUtils; projectId = utils.GetProject().id.ToString(); OnUtilsRecieved(utils); // if base param not containKey access token, then add token from util if (!baseParams.ContainsKey(XsollaApiConst.ACCESS_TOKEN)) _accessToken = utils.GetAcceessToken(); OnTranslationRecieved(utils.GetTranslations()); } else { XsollaError error = new XsollaError(); error.Parse(rootNode); OnErrorReceived(error); } } break; case DIRECTPAYMENT_FORM: { if(rootNode.Count > 8) { XsollaForm form = new XsollaForm(); form.Parse(rootNode); switch (form.GetCurrentCommand()) { case XsollaForm.CurrentCommand.STATUS: GetStatus(form.GetXpsMap()); break; case XsollaForm.CurrentCommand.CHECKOUT: case XsollaForm.CurrentCommand.CHECK: case XsollaForm.CurrentCommand.FORM: case XsollaForm.CurrentCommand.CREATE: case XsollaForm.CurrentCommand.ACCOUNT: OnFormReceived(form); break; case XsollaForm.CurrentCommand.UNKNOWN: if(rootNode.Count > 10) { OnFormReceived(form); } else { XsollaError error = new XsollaError(); error.Parse(rootNode); OnErrorReceived(error); } break; default: break; } } else { XsollaStatusPing statusPing = new XsollaStatusPing(); statusPing.Parse(rootNode); OnStatusChecked(statusPing); } } break; case DIRECTPAYMENT_STATUS: { XsollaForm form = new XsollaForm(); form.Parse(rootNode); XsollaStatus status = new XsollaStatus(); status.Parse(rootNode); OnStatusReceived(status, form); } break; case PRICEPOINTS: { XsollaPricepointsManager pricepoints = new XsollaPricepointsManager(); pricepoints.Parse(rootNode); OnPricepointsRecieved(pricepoints); } break; case GOODS: { XsollaGoodsManager goods = new XsollaGoodsManager(); goods.Parse(rootNode); OnGoodsRecieved(goods); } break; case GOODS_GROUPS: { XsollaGroupsManager groups = new XsollaGroupsManager(); groups.Parse(rootNode); OnGoodsGroupsRecieved(groups); } break; case GOODS_ITEMS: { XsollaGoodsManager goods = new XsollaGoodsManager(); goods.Parse(rootNode); OnGoodsRecieved(goods); } break; case PAYMENT_LIST: { XsollaPaymentMethods paymentMethods = new XsollaPaymentMethods(); paymentMethods.Parse(rootNode); OnPaymentMethodsRecieved(paymentMethods); } break; case SAVED_PAYMENT_LIST: { XsollaSavedPaymentMethods savedPaymentsMethods = new XsollaSavedPaymentMethods(); savedPaymentsMethods.Parse(rootNode); OnSavedPaymentMethodsRecieved(savedPaymentsMethods); } break; case QUICK_PAYMENT_LIST: { XsollaQuickPayments quickPayments = new XsollaQuickPayments(); quickPayments.Parse(rootNode); OnQuickPaymentMethodsRecieved(quickPayments); } break; case COUNTRIES: { XsollaCountries countries = new XsollaCountries(); countries.Parse(rootNode); OnCountriesRecieved(countries); } break; case VIRTUAL_PAYMENT_SUMMARY: { XVirtualPaymentSummary summary = new XVirtualPaymentSummary(); summary.Parse(rootNode); Logger.Log("VIRTUAL_PAYMENT_SUMMARY " + summary.ToString()); if(summary.IsSkipConfirmation) { Logger.Log("IsSkipConfirmation true"); pDataArgs.Add("dont_ask_again", 0); ProceedVPayment(pDataArgs); } else { Logger.Log("IsSkipConfirmation false"); OnVPSummaryRecieved(summary); } } break; case VIRTUAL_PROCEED: { XProceed proceed = new XProceed(); proceed.Parse(rootNode); Logger.Log ("VIRTUAL_PROCEED " + proceed.ToString()); if(proceed.IsInvoiceCreated) { Logger.Log ("VIRTUAL_PROCEED 1"); long operationId = proceed.OperationId; pDataArgs.Add("operation_id", operationId); VPaymentStatus(pDataArgs); } else { Logger.Log ("VIRTUAL_PROCEED 0 "); OnVPProceedError(proceed.Error); } } break; case VIRTUAL_STATUS: { XVPStatus vpStatus = new XVPStatus(); vpStatus.Parse(rootNode); //{"errors":[ {"message":"Insufficient balance to complete operation"} ], "api":{"ver":"1.0.1"}, "invoice_created":"false", "operation_id":"0", "code":"0"} Logger.Log ("VIRTUAL_STATUS" + vpStatus.ToString()); OnVPStatusRecieved(vpStatus); } break; case APPLY_PROMO_COUPONE: { XsollaForm form = new XsollaForm(); form.Parse(rootNode); OnApplyCouponeReceived(form); } break; case COUPON_PROCEED: { XsollaCouponProceedResult couponProceed = new XsollaCouponProceedResult(); couponProceed.Parse(rootNode); if (couponProceed._error != null) { Logger.Log("COUPON_PROCEED ERROR: " + couponProceed._error); OnCouponProceedErrorRecived(couponProceed); } else { long operationId = couponProceed._operationId; if (pDataArgs.ContainsKey("coupon_code")) pDataArgs.Remove("coupon_code"); pDataArgs.Add("operation_id", operationId); VPaymentStatus(pDataArgs); } } break; case HISTORY: { XsollaHistoryList history = new XsollaHistoryList().Parse(rootNode["operations"]) as XsollaHistoryList; OnHistoryRecieved(history); } break; case CALCULATE_CUSTOM_AMOUNT: { //TODO: fill method CustomVirtCurrAmountController.CustomAmountCalcRes res = new CustomVirtCurrAmountController.CustomAmountCalcRes().Parse(rootNode["calculation"]) as CustomVirtCurrAmountController.CustomAmountCalcRes; OnCustomAmountResRecieved(res); } break; default: break; } } else { XsollaError error = new XsollaError(); error.Parse(rootNode); OnErrorReceived(error); } } else { JSONNode errorNode = JSON.Parse(pRequestResult.TextRequest); string errorMsg = errorNode["errors"].AsArray[0]["message"].Value + ". Support code " + errorNode["errors"].AsArray[0]["support_code"].Value; int errorCode = 0; if(pRequestResult.ErrorText.Length > 3) errorCode = int.Parse(pRequestResult.ErrorText.Substring(0, 3)); else errorCode = int.Parse(pRequestResult.ErrorText); OnErrorReceived(new XsollaError(errorCode, errorMsg)); } if(projectId != null && !"".Equals(projectId)) LogEvent ("UNITY " + SDK_VERSION + " REQUEST", projectId, pRequestResult.Url); else LogEvent ("UNITY " + SDK_VERSION + " REQUEST", "undefined", pRequestResult.Url); }
// --------------------------------------------------------------------------- private void OnUtilsRecieved(XsollaUtils utils) { if(UtilsRecieved != null) UtilsRecieved(utils); }
private void InitFooter(XsollaUtils utils) { if (utils != null) { Text[] texts = mainScreen.GetComponentsInChildren<Text> (); XsollaTranslations translatrions = utils.GetTranslations (); texts [4].text = translatrions.Get (XsollaTranslations.SUPPORT_CUSTOMER_SUPPORT); texts [5].text = translatrions.Get (XsollaTranslations.SUPPORT_CONTACT_US); texts [6].text = translatrions.Get (XsollaTranslations.XSOLLA_COPYRIGHT); texts [7].text = translatrions.Get (XsollaTranslations.FOOTER_SECURED_CONNECTION); texts [8].text = translatrions.Get (XsollaTranslations.FOOTER_AGREEMENT); } }
private void InitHeader(XsollaUtils utils) { MainHeaderController controller = mainScreen.GetComponentInChildren<MainHeaderController>(); controller.InitScreen(utils); //Text[] texts = mainScreen.GetComponentsInChildren<Text> (); //texts [0].text = utils.GetProject ().name; }
protected override void ShowVPStatus(XsollaUtils utils, XVPStatus status) { SetLoading(false); DrawVPStatus(utils, status); }
protected override void RecieveUtils(XsollaUtils utils) { StyleManager.Instance.ChangeTheme(utils.GetSettings().GetTheme()); mainScreen = Instantiate (mainScreen); mainScreen.transform.SetParent (container.transform); mainScreen.SetActive (true); mainScreenContainer = mainScreen.GetComponentsInChildren<ScrollRect> ()[0].gameObject; menuTransform = mainScreen.GetComponentsInChildren<RectTransform> ()[8].transform; Resizer.ResizeToParrent (mainScreen); base.RecieveUtils(utils); InitHeader(utils); InitFooter (utils); if(utils.GetPurchase() == null || !utils.GetPurchase().IsPurchase()) InitMenu(utils); }
protected override void ShowVPSummary(XsollaUtils utils, XVirtualPaymentSummary summary) { SetLoading (false); DrawVPSummary (utils, summary); }
//TODO minimize private void InitMenu(XsollaUtils utils) { _radioController = menuTransform.gameObject.AddComponent <RadioGroupController> (); GameObject menuItemPrefab = Resources.Load(PREFAB_VIEW_MENU_ITEM) as GameObject; GameObject menuItemIconPrefab = Resources.Load(PREFAB_VIEW_MENU_ITEM_ICON) as GameObject; GameObject menuItemEmptyPrefab = Resources.Load(PREFAB_VIEW_MENU_ITEM_EMPTY) as GameObject; // menuTransform = mainScreen.GetComponentInChildren<HorizontalLayoutGroup> ().gameObject.transform; Dictionary <string, XComponent> components = utils.GetProject().components; XsollaPaystation2 paystation2 = utils.GetSettings().paystation2; bool isGoodsRequred = components.ContainsKey("items") && components ["items"].IsEnabled; if (isGoodsRequred) { GameObject menuItemGoods = Instantiate(menuItemPrefab) as GameObject; Text[] texts = menuItemGoods.GetComponentsInChildren <Text>(); texts[0].text = ""; texts[1].text = utils.GetTranslations().Get(XsollaTranslations.VIRTUALITEM_PAGE_TITLE); menuItemGoods.GetComponent <Button>().onClick.AddListener(delegate { LoadGoodsGroups(); _radioController.SelectItem(0); }); menuItemGoods.transform.SetParent(menuTransform); _radioController.AddButton(menuItemGoods.GetComponent <RadioButton>()); } //HACK with Unity 5.3 //bool isPricepointsRequired = components.ContainsKey("virtual_currency") && components ["virtual_currency"].IsEnabled; if (paystation2.pricepointsAtFirst != null && paystation2.pricepointsAtFirst.Equals("1")) { GameObject menuItemPricepoints = Instantiate(menuItemPrefab) as GameObject; Text[] texts = menuItemPricepoints.GetComponentsInChildren <Text>(); texts[0].text = ""; texts[1].text = utils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_TITLE); menuItemPricepoints.GetComponent <Button>().onClick.AddListener(delegate { LoadShopPricepoints(); _radioController.SelectItem(1); }); menuItemPricepoints.transform.SetParent(menuTransform); _radioController.AddButton(menuItemPricepoints.GetComponent <RadioButton>()); } if (components.ContainsKey("coupons") && components["coupons"].IsEnabled) { GameObject menuItemCoupons = Instantiate(menuItemPrefab) as GameObject; Text[] texts = menuItemCoupons.GetComponentsInChildren <Text>(); texts[0].text = ""; texts[1].text = utils.GetTranslations().Get(XsollaTranslations.COUPON_PAGE_TITLE); menuItemCoupons.GetComponent <Button>().onClick.AddListener(delegate { ShowRedeemCoupon(); _radioController.SelectItem(2); }); menuItemCoupons.transform.SetParent(menuTransform); _radioController.AddButton(menuItemCoupons.GetComponent <RadioButton>()); } GameObject menuItemEmpty = Instantiate(menuItemEmptyPrefab); menuItemEmpty.transform.SetParent(menuTransform); GameObject menuItemFavorite = Instantiate(menuItemIconPrefab); menuItemFavorite.GetComponentInChildren <Text> ().text = ""; menuItemFavorite.GetComponent <Button>().onClick.AddListener(delegate { _shopViewController.SetTitle(utils.GetTranslations().Get(XsollaTranslations.VIRTUALITEMS_TITLE_FAVORITE)); LoadFavorites(); _radioController.SelectItem(3); }); menuItemFavorite.transform.SetParent(menuTransform); _radioController.AddButton(menuItemFavorite.GetComponent <RadioButton>()); }
protected override void ShowVPStatus(XsollaUtils utils, XVPStatus status) { SetLoading (false); DrawVPStatus (utils, status); }
protected override void ShowPaymentForm(XsollaUtils utils, XsollaForm form) { Logger.Log("Payment Form recived"); DrawForm(utils, form); SetLoading(false); }
protected override void ShowVPError(XsollaUtils utils, string error) { SetLoading (false); DrawVPError (utils, error); }
public void InitScreen(XsollaUtils pUtils) { utilsLink = pUtils; back.GetComponent <Text>().text = utilsLink.GetTranslations().Get(XsollaTranslations.BACK_TO_LIST); }
protected override void ShowQuickPaymentsList(XsollaUtils utils, XsollaQuickPayments quickPayments) { }
public void DrawScreen(XsollaUtils utils) { InitTitle(utils); }
protected override void ShowPricepoints(XsollaUtils utils, XsollaPricepointsManager pricepoints) { Logger.Log ("Pricepoints recived"); OpenPricepoints (utils, pricepoints); SetLoading (false); }
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); }
//TODO minimize private void InitMenu(XsollaUtils utils) { _radioController = menuTransform.gameObject.AddComponent<RadioGroupController> (); GameObject menuItemPrefab = Resources.Load (PREFAB_VIEW_MENU_ITEM) as GameObject; GameObject menuItemIconPrefab = Resources.Load (PREFAB_VIEW_MENU_ITEM_ICON) as GameObject; GameObject menuItemEmptyPrefab = Resources.Load (PREFAB_VIEW_MENU_ITEM_EMPTY) as GameObject; // menuTransform = mainScreen.GetComponentInChildren<HorizontalLayoutGroup> ().gameObject.transform; Dictionary<string, XComponent> components = utils.GetProject().components; XsollaPaystation2 paystation2 = utils.GetSettings ().paystation2; bool isGoodsRequred = components.ContainsKey("items") && components ["items"].IsEnabled; if(isGoodsRequred) { GameObject menuItemGoods = Instantiate(menuItemPrefab) as GameObject; Text[] texts = menuItemGoods.GetComponentsInChildren<Text>(); texts[0].text = ""; texts[1].text = utils.GetTranslations().Get(XsollaTranslations.VIRTUALITEM_PAGE_TITLE); menuItemGoods.GetComponent<Button>().onClick.AddListener(delegate { LoadGoodsGroups(); _radioController.SelectItem(0); }); menuItemGoods.transform.SetParent(menuTransform); _radioController.AddButton(menuItemGoods.GetComponent<RadioButton>()); } //HACK with Unity 5.3 //bool isPricepointsRequired = components.ContainsKey("virtual_currency") && components ["virtual_currency"].IsEnabled; if (paystation2.pricepointsAtFirst != null && paystation2.pricepointsAtFirst.Equals("1")) { GameObject menuItemPricepoints = Instantiate(menuItemPrefab) as GameObject; Text[] texts = menuItemPricepoints.GetComponentsInChildren<Text>(); texts[0].text = ""; texts[1].text = utils.GetTranslations().Get(XsollaTranslations.PRICEPOINT_PAGE_TITLE); menuItemPricepoints.GetComponent<Button>().onClick.AddListener(delegate { LoadShopPricepoints(); _radioController.SelectItem(1); }); menuItemPricepoints.transform.SetParent(menuTransform); _radioController.AddButton(menuItemPricepoints.GetComponent<RadioButton>()); } if (components.ContainsKey("coupons") && components["coupons"].IsEnabled) { GameObject menuItemCoupons = Instantiate(menuItemPrefab) as GameObject; Text[] texts = menuItemCoupons.GetComponentsInChildren<Text>(); texts[0].text = ""; texts[1].text = utils.GetTranslations().Get(XsollaTranslations.COUPON_PAGE_TITLE); menuItemCoupons.GetComponent<Button>().onClick.AddListener(delegate { ShowRedeemCoupon(); _radioController.SelectItem(2); }); menuItemCoupons.transform.SetParent(menuTransform); _radioController.AddButton(menuItemCoupons.GetComponent<RadioButton>()); } GameObject menuItemEmpty = Instantiate (menuItemEmptyPrefab); menuItemEmpty.transform.SetParent (menuTransform); GameObject menuItemFavorite = Instantiate (menuItemIconPrefab); menuItemFavorite.GetComponentInChildren<Text> ().text = ""; menuItemFavorite.GetComponent<Button>().onClick.AddListener(delegate { _shopViewController.SetTitle(utils.GetTranslations().Get(XsollaTranslations.VIRTUALITEMS_TITLE_FAVORITE)); LoadFavorites(); _radioController.SelectItem(3); }); menuItemFavorite.transform.SetParent (menuTransform); _radioController.AddButton(menuItemFavorite.GetComponent<RadioButton>()); }