Ejemplo n.º 1
0
        private void SubmitRedeemForm()
        {
            TacoManager.OpenMessage(TacoConfig.Processing);
            Action <string> success = (string data) => {
                TacoManager.CloseMessage();
                GeneralResult r = JsonUtility.FromJson <GeneralResult>(data);
                string        notice;
                string        header;
                if (r.success)
                {
                    notice                = r.msg;
                    header                = TacoConfig.SuccessHeader;
                    emailInput.text       = string.Empty;
                    dateOfBirthInput.text = string.Empty;
                    streetInput.text      = string.Empty;
                    buildingInput.text    = string.Empty;
                    countryInput.text     = string.Empty;
                    stateInput.text       = string.Empty;
                    postcodeInput.text    = string.Empty;
                    cityInput.text        = string.Empty;
                    TacoManager.UpdateTicketOnly(r.ticket.ToString());
                    TournamentManager.Instance.SetMoneytext();
                    moneyValue.text = TacoManager.FormatRP(TacoManager.User.ticket);
                }
                else
                {
                    notice = r.err;
                    header = TacoConfig.ErrorHeader;
                }
                TacoManager.OpenModalGeneralResultPanel(r.success, header, notice);
            };
            Action <string, string> fail = (string data, string error) => {
                TacoManager.CloseMessage();
                GeneralResult r = JsonUtility.FromJson <GeneralResult>(data);
                TacoManager.OpenModalGeneralResultPanel(false, TacoConfig.ErrorHeader, r.err);
            };

            StartCoroutine(ApiManager.Instance.SubmitRedeemInfo(purchasingPrize,
                                                                emailInput.text,
                                                                dateOfBirthInput.text,
                                                                streetInput.text,
                                                                buildingInput.text,
                                                                countryInput.text,
                                                                stateInput.text,
                                                                postcodeInput.text,
                                                                cityInput.text,
                                                                success, fail));
        }