示例#1
0
 private void AddAddressesEvent()
 {
     SubmitAddessesBtn.onClick.AddListener(() => {
         if (!string.IsNullOrEmpty(addressInput.text + address2Input.text + cityInput.text + stateInput.text + zipcodeInput.text))
         {
             TacoManager.OpenMessage(TacoConfig.Processing);
             Action <string> success = (string data) => {
                 TacoManager.CloseMessage();
                 GeneralResult r = JsonUtility.FromJson <GeneralResult>(data);
                 string notice   = string.Empty;
                 string header   = string.Empty;
                 if (r.success)
                 {
                     notice = r.msg;
                     header = TacoConfig.SuccessHeader;
                     TacoManager.User.contactProfile.UpdateData(addressInput.text, address2Input.text, cityInput.text, stateInput.text, zipcodeInput.text);
                     FillFullAddress();
                 }
                 else
                 {
                     notice = r.err;
                     header = TacoConfig.ErrorHeader;
                     FillAddressesField();
                 }
                 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.ChangeAddress(addressInput.text, address2Input.text, cityInput.text, stateInput.text, zipcodeInput.text, success, fail));
         }
     });
 }
示例#2
0
        private void SubmitPurchaseToken()
        {
            TacoManager.OpenMessage(TacoConfig.Processing);
            Action <string> success = (string data) => {
                TacoManager.CloseMessage();
                GeneralResult r = JsonUtility.FromJson <GeneralResult>(data);
                string        notice;
                string        header;
                if (r.success)
                {
                    TacoManager.UpdateFundsWithToken(r.cash, r.token.ToString(), r.ticket.ToString());
                    moneyValue.text = TacoManager.FormatGTokens(double.Parse(TacoManager.User.gToken));
                    TournamentManager.Instance.SetMoneytext();
                    header = TacoConfig.SuccessHeader;
                    notice = r.msg;
                }
                else
                {
                    header = TacoConfig.ErrorHeader;
                    notice = r.err;
                }

                TacoManager.OpenModalGeneralResultPanel(r.success, header, notice);
            };
            Action <string, string> fail = (string data, string error) => {
                TacoManager.CloseMessage();
                TacoManager.OpenModalConnectionErrorPanel(error);
            };
            string currency = exchangedCurrencyIcon.sprite == TacoConfig.currencySprites[0] ? "0" : "2";

            StartCoroutine(ApiManager.Instance.BuyToken(currency, exchangedNumber, success, fail));
        }
示例#3
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));
        }
示例#4
0
        private void SendWithdrawRequest()
        {
            TacoManager.OpenMessage(TacoConfig.TacoLoginStatusMessage00);
            Action <string> onSuccess = (string data) => {
                GeneralResult r = JsonUtility.FromJson <GeneralResult>(data);
                if (r.success)
                {
                    TacoManager.CloseMessage();
                    TacoManager.OpenModalGeneralResultPanel(r.success, TacoConfig.SuccessHeader, "You will receive a confirmation email within\n1 Business day once the withdraw amount has been approved.");
                    TacoManager.UpdateFundsOnly(r.cash);
                    if (wdSaveProfile.isOn)
                    {
                        TacoManager.User.contactProfile.UpdateData(wdAddress1Input.text, wdAddress2Input.text, wdCityInput.text, wdStateInput.text, wdZipcodeInput.text);
                    }
                    ResetWithdrawInputField();
                    moneyValue.text    = TacoManager.FormatCash(TacoManager.User.TotalCash);
                    availableFund.text = TacoManager.FormatCash(TacoManager.User.funds);
                    TournamentManager.Instance.SetMoneytext();
                    defaultAddress.text = TacoManager.User.contactProfile.FullAddress();
                    if (switchAddressBtn.transform.GetChild(0).GetComponent <Text>().text == TacoConfig.NoDefaultAddress)
                    {
                        withdrawBtn.onClick.Invoke();
                    }
                }
                else
                {
                    TacoManager.CloseMessage();
                    TacoManager.OpenModalGeneralResultPanel(false, TacoConfig.Error, r.msg);
                }
                TacoManager.CloseMessage();
            };
            Action <string, string> onFail = (string data, string error) => {
                TacoManager.OpenModalGeneralResultPanel(false, TacoConfig.ErrorHeader, error);
                TacoManager.CloseMessage();
            };

            if (newAddress.activeSelf)
            {
                StartCoroutine(ApiManager.Instance.Withdraw(withdrawAmoutInput.text, wdAddress1Input.text, wdAddress2Input.text, wdCityInput.text, wdStateInput.text, wdZipcodeInput.text, wdSaveProfile.isOn, onSuccess, onFail));
            }
            else
            {
                ContactProfile addr = TacoManager.User.contactProfile;
                StartCoroutine(ApiManager.Instance.Withdraw(withdrawAmoutInput.text, addr.address, addr.address2, addr.city, addr.state, addr.zipcode, false, onSuccess, onFail));
            }
        }
示例#5
0
        public void Reset()
        {
            TacoManager.OpenMessage(TacoConfig.Processing);
            Action <string> success = (string data) => {
                TacoManager.CloseMessage();
                GeneralResult r      = JsonUtility.FromJson <GeneralResult> (data);
                string        notice = r.success ? r.msg : r.err;
                string        header = r.success ? TacoConfig.EmailSentHeader : 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.ResetPassword(resetAccount.text, success, fail));
            resetAccount.text = string.Empty;
        }
示例#6
0
        private void AddPasswordChangeEvent()
        {
            currentPassword.onEndEdit.AddListener((string value) => {
                if (string.IsNullOrEmpty(value))
                {
                    return;
                }
                if (value.Length < TacoConfig.PasswordMinLength)
                {
                    CurrentPasswordNotOk.SetActive(true);
                    currentPasswordErrorMsg.text         = TacoConfig.TacoRegisteredErrorMessage07;
                    SubmitPasswordChangeBtn.interactable = false;
                }
                else
                {
                    CurrentPasswordNotOk.SetActive(false);
                    SubmitPasswordChangeBtn.interactable = !NewPasswordNotOk.activeSelf && !ConfirmPasswordNotOk.activeSelf && !string.IsNullOrEmpty(confirmPassword.text);
                }
            });
            newPassword.onEndEdit.AddListener((string value) => {
                if (string.IsNullOrEmpty(value))
                {
                    return;
                }
                if (value.Length < TacoConfig.PasswordMinLength)
                {
                    NewPasswordNotOk.SetActive(true);
                    newPasswordErrorMsg.text             = TacoConfig.TacoRegisteredErrorMessage07;
                    SubmitPasswordChangeBtn.interactable = false;
                }
                else
                {
                    NewPasswordNotOk.SetActive(false);
                    if (!string.IsNullOrEmpty(confirmPassword.text))
                    {
                        if (value == confirmPassword.text)
                        {
                            ConfirmPasswordNotOk.SetActive(false);
                            SubmitPasswordChangeBtn.interactable = currentPassword.text.Length >= TacoConfig.PasswordMinLength;
                        }
                        else if (!ConfirmPasswordNotOk.activeSelf)
                        {
                            ConfirmPasswordNotOk.SetActive(true);
                            confirmPasswordErrorMsg.text         = TacoConfig.TacoRegisteredErrorMessage00;
                            SubmitPasswordChangeBtn.interactable = false;
                        }
                    }
                    else
                    {
                        SubmitPasswordChangeBtn.interactable = false;
                    }
                }
            });
            confirmPassword.onEndEdit.AddListener((string value) => {
                if (string.IsNullOrEmpty(value))
                {
                    return;
                }
                if (value != newPassword.text)
                {
                    ConfirmPasswordNotOk.SetActive(true);
                    confirmPasswordErrorMsg.text         = TacoConfig.TacoRegisteredErrorMessage00;
                    SubmitPasswordChangeBtn.interactable = false;
                }
                else if (value.Length >= TacoConfig.PasswordMinLength)
                {
                    ConfirmPasswordNotOk.SetActive(false);
                    SubmitPasswordChangeBtn.interactable = currentPassword.text.Length >= TacoConfig.PasswordMinLength;
                }
            });

            SubmitPasswordChangeBtn.onClick.AddListener(() => {
                TacoManager.OpenMessage(TacoConfig.Processing);
                Action <string> success = (string data) => {
                    TacoManager.CloseMessage();
                    GeneralResult r = JsonUtility.FromJson <GeneralResult>(data);
                    string notice   = r.success ? r.msg : r.err;
                    string header   = r.success ? TacoConfig.SuccessHeader : TacoConfig.Error;
                    TacoManager.OpenModalGeneralResultPanel(r.success, header, notice);
                    confirmPassword.text = string.Empty;
                    newPassword.text     = string.Empty;
                    currentPassword.text = string.Empty;
                };
                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.ChangePassword(currentPassword.text, newPassword.text, confirmPassword.text, success, fail));
                SubmitPasswordChangeBtn.interactable = false;
            });
        }