Beispiel #1
0
        public IParseble Parse(JSONNode rootNode)
        {
            JSONNode statusNode = rootNode[XsollaApiConst.R_STATUS];

            if (statusNode != null && !"null".Equals(statusNode.ToString()))
            {
                this.group            = statusNode[S_GROUP];
                this.invoice          = statusNode[S_INVOICE];
                this.statusData       = new XsollaStatusData(statusNode[S_DATA]);
                this.text             = new XsollaStatusText(statusNode[S_TEXT]);
                this.country          = statusNode["country"];
                this.returnRegion     = statusNode["return_region"];
                this.isCancelUser     = statusNode["isCancelUser"].AsBool;
                this.isPreloader      = statusNode["isPreloader"].AsBool;
                this.showEmailRequest = statusNode["showEmailRequest"].AsBool;
                this.titleClass       = statusNode["title_class"];
                this.needToCheck      = statusNode["needToCheck"].AsBool;
            }
            return(this);
        }
 public IParseble Parse(JSONNode rootNode)
 {
     JSONNode statusNode = rootNode[XsollaApiConst.R_STATUS];
     if (statusNode != null && !"null".Equals(statusNode.ToString()))
     {
         this.group = statusNode[S_GROUP];
         this.invoice = statusNode[S_INVOICE];
         this.statusData = new XsollaStatusData(statusNode[S_DATA]);
         this.text = new XsollaStatusText(statusNode[S_TEXT]);
         this.country = statusNode["country"];
         this.returnRegion = statusNode["return_region"];
         this.isCancelUser = statusNode["isCancelUser"].AsBool;
         this.isPreloader = statusNode["isPreloader"].AsBool;
         this.showEmailRequest = statusNode["showEmailRequest"].AsBool;
         this.titleClass = statusNode["title_class"];
         this.needToCheck = statusNode["needToCheck"].AsBool;
     }
     return this;
 }
        public override void InitScreen(XsollaTranslations translations, XsollaStatus xsollaStatus)
        {
            ResizeToParent();
            string           input      = translations.Get(XsollaTranslations.STATUS_PURCHASED_DESCRIPTION);
            XsollaStatusText statusText = xsollaStatus.GetStatusText();

            XsollaStatus.Group currentStatus = xsollaStatus.GetGroup();
            if (input != null)
            {
                string pattern = "{{.*?}}";
                Regex  regex   = new Regex(pattern);
                input = regex.Replace(input, statusText.GetPurchsaeValue(), 1);
                input = regex.Replace(input, statusText.Get("sum").GetValue(), 1);
            }
            else
            {
                input = "";
            }
            PrepareStatus(currentStatus, xsollaStatus.GetStatusText().GetState(), input, xsollaStatus.GetInvoice());
            AddTitle(statusText.GetProjectString());
            if (currentStatus == XsollaStatus.Group.DONE)
            {
                AddStatus(translations.Get(XsollaTranslations.VIRTUALSTATUS_DONE_DESCRIPTIONS));
            }

            AddElement(statusText.GetPurchsaeValue(), statusText.Get("sum").GetValue());

            XsollaStatusText.StatusTextElement element = statusText.Get("out");
            if (element != null)
            {
                AddElement(statusText.Get("out").GetPref(), statusText.Get("out").GetValue());
            }
            element = statusText.Get("invoice");
            if (element != null)
            {
                AddElement(statusText.Get("invoice").GetPref(), statusText.Get("invoice").GetValue());
            }
            element = statusText.Get("details");
            if (element != null)
            {
                AddElement(statusText.Get("details").GetPref(), statusText.Get("details").GetValue());
            }
            element = statusText.Get("time");
            if (element != null)
            {
                AddElement(statusText.Get("time").GetPref(), statusText.Get("time").GetValue());
            }
            element = statusText.Get("merchant");
            if (element != null)
            {
                AddElement(statusText.Get("merchant").GetPref(), statusText.Get("merchant").GetValue());
            }
            element = statusText.Get("userWallet");
            if (element != null)
            {
                AddElement(statusText.Get("userWallet").GetPref(), statusText.Get("userWallet").GetValue());
            }
            AddLine();
            AddBigElement(statusText.Get("sum").GetPref(), statusText.Get("sum").GetValue());
//			Debug.Log ("statusText.backUrlCaption " + statusText.backUrlCaption);

            if (statusText.backUrlCaption != null && !"".Equals(statusText.backUrlCaption))
            {
                statusViewExitButton.gameObject.GetComponent <Text> ().text = statusText.backUrlCaption;
            }
            else
            {
                statusViewExitButton.gameObject.GetComponent <Text> ().text = translations.Get(XsollaTranslations.BACK_TO_STORE);
            }
            statusViewExitButton.onClick.AddListener(delegate { OnClickExit(currentStatus, xsollaStatus.GetStatusData().GetInvoice(), xsollaStatus.GetStatusData().GetStatus(), null); });
        }
        public override void InitScreen(XsollaTranslations translations, XsollaStatus xsollaStatus)
        {
            ResizeToParent();

            GameObject.FindObjectOfType <MainHeaderController>().setStateUserMenu(false);

            string           input      = translations.Get(XsollaTranslations.STATUS_PURCHASED_DESCRIPTION);
            XsollaStatusText statusText = xsollaStatus.GetStatusText();

            XsollaStatus.Group currentStatus = xsollaStatus.GetGroup();
            if (input != null)
            {
                string pattern = "{{.*?}}";
                Regex  regex   = new Regex(pattern);

                if ((statusText.GetPurchsaeValue() != "") && (statusText.Get("sum").GetValue() != ""))
                {
                    input = regex.Replace(input, statusText.GetPurchsaeValue(), 1);
                    input = regex.Replace(input, statusText.Get("sum").GetValue(), 1);
                }
                else
                {
                    input = "";
                }
            }
            else
            {
                input = "";
            }
            PrepareStatus(currentStatus, xsollaStatus.GetStatusText().GetState(), input, xsollaStatus.GetInvoice(), xsollaStatus);
            AddTitle(statusText.GetProjectString());
            if (currentStatus == XsollaStatus.Group.DONE)
            {
                AddStatus(translations.Get(XsollaTranslations.VIRTUALSTATUS_DONE_DESCRIPTIONS));
            }

            if (statusText.GetPurchsaeValue() != "")
            {
                AddElement(statusText.GetPurchsaeValue(), statusText.Get("sum").GetValue());
            }

            XsollaStatusText.StatusTextElement element = statusText.Get("out");
            if (element != null)
            {
                AddElement(statusText.Get("out").GetPref(), statusText.Get("out").GetValue());
            }
            element = statusText.Get("invoice");
            if (element != null)
            {
                AddElement(statusText.Get("invoice").GetPref(), statusText.Get("invoice").GetValue());
            }
            element = statusText.Get("details");
            if (element != null)
            {
                AddElement(statusText.Get("details").GetPref(), statusText.Get("details").GetValue());
            }
            element = statusText.Get("time");
            if (element != null)
            {
                AddElement(statusText.Get("time").GetPref(), statusText.Get("time").GetValue());
            }
            element = statusText.Get("merchant");
            if (element != null)
            {
                AddElement(statusText.Get("merchant").GetPref(), statusText.Get("merchant").GetValue());
            }
            element = statusText.Get("userWallet");
            if (element != null)
            {
                AddElement(statusText.Get("userWallet").GetPref(), statusText.Get("userWallet").GetValue());
            }
            AddLine();
            AddBigElement(statusText.Get("sum").GetPref(), statusText.Get("sum").GetValue());

            statusViewExitButton.gameObject.GetComponent <Text> ().text = translations.Get(XsollaTranslations.BACK_TO_STORE);
            statusViewExitButton.onClick.AddListener(delegate
            {
                //OnClickExit(currentStatus, xsollaStatus.GetStatusData().GetInvoice(), xsollaStatus.GetStatusData().GetStatus(), null);
                OnClickBack(currentStatus, xsollaStatus.GetStatusData().GetInvoice(), xsollaStatus.GetStatusData().GetStatus(), null);
            });
        }