GetNextStepString() public method

public GetNextStepString ( ) : string
return string
コード例 #1
0
        public void InitView(XsollaTranslations pTranslations, XsollaForm form)
        {
            _form = form;
            // if have skipCheckout and this checkout form
            if ((form.GetCurrentCommand() == XsollaForm.CurrentCommand.CHECKOUT) && form.GetSkipChekout())
            {
                string checkoutToken  = _form.GetCheckoutToken();
                bool   isLinkRequired = checkoutToken != null &&
                                        !"".Equals(checkoutToken) &&
                                        !"null".Equals(checkoutToken) &&
                                        !"false".Equals(checkoutToken);
                if (isLinkRequired)
                {
                    OnClickPay(isLinkRequired);
                    return;
                }
            }

            string pattern = "{{.*?}}";
            Regex  regex   = new Regex(pattern);
            string title   = regex.Replace(pTranslations.Get(XsollaTranslations.PAYMENT_PAGE_TITLE_VIA), form.GetTitle(), 1);

            layout.AddObject(GetTitle(title));
            layout.AddObject(GetError(form.GetError()));
            layout.AddObject(GetInfo(form.GetMessage()));
            if (form.GetVisible().Count > 0)
            {
                GameObject formView = GetFormView(form, pTranslations);
                layout.AddObject(formView);
            }
            if (form.GetAccountXsolla() != null && !"".Equals(form.GetAccountXsolla()) && !"null".Equals(form.GetAccountXsolla()))
            {
                layout.AddObject(GetTwoTextPlate("Xsolla number", form.GetAccountXsolla()));
            }
            if (form.GetAccount() != null && !"".Equals(form.GetAccount()) && !"null".Equals(form.GetAccount()))
            {
                layout.AddObject(GetTwoTextPlate("2pay number", form.GetAccount()));
            }
            if (form.IsValidPaymentSystem())
            {
                layout.AddObject(GetTextPlate(pTranslations.Get(XsollaTranslations.FORM_CC_EULA)));
            }
            GameObject footerInstance = Instantiate(footer);

            Text[] footerTexts = footerInstance.GetComponentsInChildren <Text> ();
//			footerTexts [0].text = "back";//back
            string nextStep = form.GetNextStepString();

            footerTexts [2].text = nextStep;            //translations.Get (XsollaTranslations.FORM_CONTINUE);//pay now
            Button[] footerButtons = footerInstance.GetComponentsInChildren <Button> ();
            if (OnClickBack != null)
            {
                footerButtons [0].onClick.AddListener(() => {
                    OnBack();
                });
            }
            else
            {
                footerButtons [0].gameObject.SetActive(false);
            }

            if (form.GetCurrentCommand() == XsollaForm.CurrentCommand.ACCOUNT ||
                form.GetCurrentCommand() == XsollaForm.CurrentCommand.CREATE ||
                form.GetCurrentCommand() == XsollaForm.CurrentCommand.CHECKOUT) //
            {
                footerTexts [1].text = "";                                      //total
                RectTransform buttonRect = footerButtons [1].GetComponent <RectTransform>();
                Vector2       vecMin     = buttonRect.anchorMin;
                vecMin.x             = vecMin.x - (buttonRect.anchorMax.x - vecMin.x) / 2;
                buttonRect.anchorMin = vecMin;
            }
            else
            {
                footerTexts [1].text = pTranslations.Get(XsollaTranslations.TOTAL) + " " + form.GetSumTotal();                  //total
            }

            layout.AddObject(footerInstance);
            layout.Invalidate();

            if (!"".Equals(nextStep) && form.GetCurrentCommand() != XsollaForm.CurrentCommand.ACCOUNT)
            {
                string checkoutToken  = _form.GetCheckoutToken();
                bool   isLinkRequired = checkoutToken != null &&
                                        !"".Equals(checkoutToken) &&
                                        !"null".Equals(checkoutToken) &&
                                        !"false".Equals(checkoutToken);
                string link = "https://secure.xsolla.com/pages/checkout/?token=" + _form.GetCheckoutToken();
                if (isLinkRequired && Application.platform == RuntimePlatform.WebGLPlayer)
                {
                    RectTransform buttonRect = footerButtons [1].GetComponent <RectTransform>();
                    int           width      = (int)(buttonRect.rect.xMax - buttonRect.rect.xMin);
                    int           height     = (int)(buttonRect.rect.yMax - buttonRect.rect.yMin);
                    height = height * 8;
                    Vector3[] vec = new Vector3[4];
                    buttonRect.GetWorldCorners(vec);
                    int xPos = (int)vec[0].x;
                    int yPos = (int)vec[0].y;
                    yPos = yPos / 2;
                    CreateLinkButtonWebGl(xPos, yPos, width, height, link, "CardPaymeentForm", "Next");
                    footerButtons [1].onClick.AddListener(() => {
                        OnClickPay(false);
                    });
                }
                else
                {
                    footerButtons [1].onClick.AddListener(() => {
                        OnClickPay(isLinkRequired);
                    });
                }
            }
            else
            {
                footerButtons [1].gameObject.SetActive(false);
            }
        }