private void OnClickBack(XsollaStatus.Group group, string invoice, Xsolla.XsollaStatusData.Status status, Dictionary <string, object> pPurchase) { if (StatusHandler != null) { StatusHandler(group, invoice, status, pPurchase); } if (GetComponentInParent <XsollaPaystationController> () != null) { GetComponentInParent <XsollaPaystationController> ().LoadGoodsGroups(); } }
private void OnUserStatusExit(XsollaStatus.Group group, string invoice, Xsolla.XsollaStatusData.Status status, Dictionary <string, object> pPurchase = null) { Logger.Log("On user exit status screen"); switch (group) { case XsollaStatus.Group.DONE: Logger.Log("Status Done"); menuTransform.gameObject.SetActive(true); if (result == null) { result = new XsollaResult(); } result.invoice = invoice; result.status = status; if (pPurchase != null) { result.purchases = pPurchase; } Logger.Log("Ivoice ID " + result.invoice); Logger.Log("Status " + result.status); Logger.Log("Bought", result.purchases); TransactionHelper.Clear(); if (OkHandler != null) { OkHandler(result); } else { Logger.Log("Have no OkHandler"); } break; case XsollaStatus.Group.TROUBLED: case XsollaStatus.Group.INVOICE: case XsollaStatus.Group.UNKNOWN: default: result.invoice = invoice; result.status = status; Logger.Log("Ivoice ID " + result.invoice); Logger.Log("Status " + result.status); Logger.Log("Bought", result.purchases); TransactionHelper.Clear(); if (OkHandler != null) { OkHandler(result); } else { Logger.Log("Have no OkHandler"); } break; } }
private void OnClickBack(XsollaStatus.Group group, string invoice, Xsolla.XsollaStatusData.Status status, Dictionary <string, object> pPurchase) { if (StatusHandler != null) { StatusHandler(group, invoice, status, pPurchase); } if (GetComponentInParent <XsollaPaystationController> () != null) { GetComponentInParent <XsollaPaystationController> ().NavMenuClick(RadioButton.RadioType.SCREEN_GOODS); } }
private void OnClickExit(XsollaStatus.Group group, string invoice, Xsolla.XsollaStatusData.Status status, Dictionary <string, object> pPurchase) { if (StatusHandler != null) { StatusHandler(group, invoice, status, pPurchase); } if (GetComponentInParent <XsollaPaystationController> () != null) { GetComponentInParent <XsollaPaystationController> ().gameObject.GetComponentInChildren <Selfdestruction> ().DestroyRoot(); } }
public IParseble Parse(SimpleJSON.JSONNode rootNode) { if (rootNode != null && !"null".Equals(rootNode.ToString())) { this._status = rootNode["status"]; this._final = rootNode["final"].AsBool; this._elapsedTime = rootNode["elapsedTime"].AsInt; switch (rootNode["group"]) { case "invoice": { this._group = XsollaStatus.Group.INVOICE; break; } case "done": { this._group = XsollaStatus.Group.DONE; break; } case "delivering": { this._group = XsollaStatus.Group.DELIVERING; break; } case "troubled": { this._group = XsollaStatus.Group.TROUBLED; break; } default: { this._group = XsollaStatus.Group.UNKNOWN; break; } } } return(this); }
public void PrepareStatus(XsollaStatus.Group group, string state, string purchase, string invoice) { Component[] texts = status.GetComponentsInChildren(typeof(Text), true); // [0] Icon [1] Title [2] purchse // Image bg = status.GetComponent<Image> (); ColorController colorController = GetComponent <ColorController> (); ((Text)texts[1]).text = state; if (purchase != null && purchase != "") { ((Text)texts[2]).text = purchase; texts[2].gameObject.SetActive(true); } else { texts[2].gameObject.SetActive(false); } switch (group) { case XsollaStatus.Group.DONE: ((Text)texts[0]).text = ""; colorController.ChangeColor(1, StyleManager.BaseColor.bg_ok); break; case XsollaStatus.Group.TROUBLED: ((Text)texts[0]).text = ""; colorController.ChangeColor(1, StyleManager.BaseColor.bg_error); // bg.color = new Color (0.980392157f, 0.454901961f, 0.392156863f); break; case XsollaStatus.Group.INVOICE: case XsollaStatus.Group.DELIVERING: case XsollaStatus.Group.UNKNOWN: default: ((Text)texts[0]).text = ""; ((Text)texts[0]).gameObject.AddComponent <MyRotation>(); colorController.ChangeColor(1, StyleManager.BaseColor.selected); // bg.color = new Color (0.639215686f, 0.552941176f, 0.847058824f); StartCoroutine(UpdateStatus(invoice)); break; } }
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 IParseble Parse(SimpleJSON.JSONNode rootNode) { if (rootNode != null && !"null".Equals(rootNode.ToString())) { this._status = rootNode["status"]; this._final = rootNode["final"].AsBool; this._elapsedTime = rootNode["elapsedTime"].AsInt; switch(rootNode["group"]) { case "invoice": { this._group = XsollaStatus.Group.INVOICE; break; } case "done": { this._group = XsollaStatus.Group.DONE; break; } case "delivering": { this._group = XsollaStatus.Group.DELIVERING; break; } case "troubled": { this._group = XsollaStatus.Group.TROUBLED; break; } default: { this._group = XsollaStatus.Group.UNKNOWN; break; } } } return this; }
private void OnUserStatusExit(XsollaStatus.Group group, XsollaStatusData statusData) { Logger.Log("On user exit status screen"); switch (group) { case XsollaStatus.Group.DONE: Logger.Log("Status Done"); menuTransform.gameObject.SetActive(true); result.invoice = statusData.GetInvoice(); result.status = statusData.GetStatus(); Logger.Log("Ivoice ID " + result.invoice); Logger.Log("Status " + result.status); Logger.Log("Bought", result.purchases); TransactionHelper.Clear(); if (OkHandler != null) { OkHandler(result); } else { Logger.Log("Have no OkHandler"); } break; case XsollaStatus.Group.TROUBLED: Logger.Log("Status TROUBLED"); TryAgain(); break; case XsollaStatus.Group.INVOICE: case XsollaStatus.Group.UNKNOWN: default: Logger.Log("Status in proccess"); TryAgain(); break; } }
public void DrawScreen(XsollaTranslations translations, XsollaStatus xsollaStatus) { ResizeToParent(); XsollaStatus.Group group = xsollaStatus.GetGroup(); switch (group) { case XsollaStatus.Group.DONE: linerLayout.AddObject(GetOkStatus(xsollaStatus.GetStatusText().GetState())); break; case XsollaStatus.Group.TROUBLED: linerLayout.AddObject(GetErrorByString(xsollaStatus.GetStatusText().GetState())); break; case XsollaStatus.Group.INVOICE: case XsollaStatus.Group.UNKNOWN: default: linerLayout.AddObject(GetWaitingStatus(xsollaStatus.GetStatusText().GetState())); StartCoroutine(TryIt(xsollaStatus.GetInvoice())); break; } linerLayout.AddObject(GetError(null)); linerLayout.AddObject(GetEmpty()); adapter.SetElements(xsollaStatus.GetStatusText().GetStatusTextElements()); GameObject list = GetList(adapter); list.GetComponent <ListView> ().DrawList(GetComponent <RectTransform> ()); linerLayout.AddObject(list); linerLayout.AddObject(GetEmpty()); if (group == XsollaStatus.Group.INVOICE || group == XsollaStatus.Group.UNKNOWN) { linerLayout.AddObject(GetButton("Start again", delegate { StartAgain(); })); linerLayout.AddObject(GetEmpty()); } linerLayout.Invalidate(); }
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); }); }