public void UpdateHighScoreAndGtokens(int newHighScore) { TacoConfig.print(newHighScore); TacoManager.OpenMessage("Sending High Score"); Action <string> success = (string data) => { var r = JsonUtility.FromJson <UpdateHighScoreAndTokensResult>(data); if (r.success) { TacoConfig.print("Update highscore for user success" + r); TacoManager.UpdateTokenOnly(r.gtokens); TacoSetup.Instance.CallMessage("ShowModalEarningTokens"); } }; Action <string, string> fail = (string data, string error) => { TacoManager.CloseAllModals(); TacoConfig.print("Error on register : " + data); if (!string.IsNullOrEmpty(error)) { TacoConfig.print("Error : " + error); } TacoManager.CloseMessage(); string msg = data + (string.IsNullOrEmpty(error) ? "" : " : " + error); if (!string.IsNullOrEmpty(data)) { ErrorResult errorResult = JsonUtility.FromJson <ErrorResult>(data); if (!errorResult.success) { msg = errorResult.message; } } TacoConfig.print(msg); }; StartCoroutine(ApiManager.Instance.UpdateHighScoreAndGTokens(newHighScore, TacoManager.User.token, success, fail)); }
public void Register() { Debug.Log("Register Pressed"); var email = EmailInput.text; var password = PasswordInput.text; var age = PolicyToggle.isOn; var user = UserInput.text; var refCode = ReferenceCodeInput.text; if (validateInput()) { //StartCoroutine(postRegister(email, password, age, avatar, user)); TacoManager.OpenMessage(TacoConfig.TacoRegisteredStatusMessage00); Action <string> success = (string data) => { Debug.Log(data); LoginResult r = JsonUtility.FromJson <LoginResult>(data); if (r.success) { TacoManager.CloseMessage(); // email sent, have to wait for them to verify. //TacoManager.OpenModal(TacoConfig.TacoRegisteredModalTitle, r.message, null, "RegisterResult"); TacoManager.OpenModalRegisterPanel(string.IsNullOrEmpty(r.displayName) ? r.name : r.displayName); LoginPanel.Instance.SetCredential(EmailInput.text, PasswordInput.text); // clean up the registerpanel Init(); TacoManager.CloseTaco(); TacoManager.TacoAuthCanvas.SetActive(true); LoginPanel.Instance.gameObject.SetActive(true); LoginPanel.Instance.Login(); } else { TacoSetup.Instance.LogEvent("signup_failed"); // an error returned TacoManager.CloseMessage(); //TacoManager.OpenModal(TacoConfig.TacoRegisteredErrorHeader, r.message); TacoManager.OpenModalAccountCreationErrorPanel(TacoConfig.TacoRegisteredErrorHeader, r.message); } }; Action <string, string> fail = (string data, string error) => { TacoSetup.Instance.LogEvent("signup_failed"); ErrorResult errorResult = JsonUtility.FromJson <ErrorResult>(data); Debug.Log("Error on register : " + data); if (!string.IsNullOrEmpty(error)) { Debug.Log("Error : " + error); } TacoManager.CloseMessage(); string msg = data + (string.IsNullOrEmpty(error) ? string.Empty : " : " + error); if (!string.IsNullOrEmpty(data)) { if (!errorResult.success) { msg = errorResult.message; } } TacoManager.OpenModalAccountCreationErrorPanel(TacoConfig.TacoRegisteredErrorHeader, msg); if (errorResult.verErr) { TacoManager.OpenModalIncorrectVersionPanel(errorResult.message); } }; StartCoroutine(ApiManager.Instance.Register(user, email, password, age, refCode, success, fail)); } }
public void Register() { TacoConfig.print("Register Pressed"); var email = EmailInput.GetComponent <InputField>().text; var password = PasswordInput.GetComponent <InputField>().text; var age = AgeToggle.GetComponent <Toggle>().isOn; var user = UserInput.GetComponent <InputField>().text; if (validateInput()) { int avatar = 0; //StartCoroutine(postRegister(email, password, age, avatar, user)); TacoManager.OpenMessage(TacoConfig.TacoRegisteredStatusMessage00); Action <string> success = (string data) => { TacoConfig.print(data); LoginResult r = JsonUtility.FromJson <LoginResult>(data); TacoConfig.print("Result = " + r.success + " - " + r.started.Count + " - " + r.ended.Count + " - " + r.userId + " - " + r.funds); if (r.success) { TacoManager.CloseMessage(); // email sent, have to wait for them to verify. TacoManager.OpenModal(TacoConfig.TacoRegisteredModalTitle, r.message, null, "TacoRegisterResult"); // clean up the registerpanel Init(); } else { // an error returned TacoManager.CloseMessage(); TacoManager.OpenModal(TacoConfig.TacoRegisteredErrorHeader, r.message); } }; Action <string, string> fail = (string data, string error) => { TacoConfig.print("Error on register : " + data); if (!string.IsNullOrEmpty(error)) { TacoConfig.print("Error : " + error); } TacoManager.CloseMessage(); string msg = data + (string.IsNullOrEmpty(error) ? "" : " : " + error); if (!string.IsNullOrEmpty(data)) { ErrorResult errorResult = JsonUtility.FromJson <ErrorResult>(data); if (!errorResult.success) { msg = errorResult.message; } } TacoManager.OpenModal(TacoConfig.TacoLoginErrorHeader, msg); }; StartCoroutine(ApiManager.Instance.Register(user, email, password, age, success, fail)); } }