public IEnumerator OnNewGuest(VOGControllerAuth ctrl, AvatarGender gender) { try { ctrl.DisableInput(); //Create guest ApiCall call = VostopiaClient.Authentication.BeginSignInGuest(gender); IEnumerator e = call.Wait(); while (e.MoveNext()) { yield return e.Current; } if (!VostopiaClient.Authentication.EndSignIn(call)) { ctrl.ShowMessageDialog("Uh-oh", "There was an error creating a guest account for you. Please try again.", () => { }); yield break; } //Store authentication key if (call.ResponseData["authKey"] != null) { string authKey = (string)call.ResponseData["authKey"]; ctrl.StoreGuestAuthenticationKey(authKey); } //Continue to auth completed screen ctrl.AuthenticationCompleted(); } finally { ctrl.EnableInput(); } }
public IEnumerator OnNewUser(VOGControllerAuth ctrl, AvatarGender gender) { try { ctrl.DisableInput(); //Create user ApiCall call = VostopiaClient.Authentication.BeginRegister(Email, KeepInTouch, gender); IEnumerator e = call.Wait(); while (e.MoveNext()) { yield return e.Current; } var registerResult = VostopiaClient.Authentication.EndRegister(call); if (registerResult != VostopiaAuthenticationClient.RegisterResult.SUCCESS) { Debug.LogWarning("Error creating new user, " + registerResult); string msg = ""; if (registerResult == VostopiaAuthenticationClient.RegisterResult.USER_ALREADY_EXISTS) { msg = "That email address is already in use! Please try another."; } else if (registerResult == VostopiaAuthenticationClient.RegisterResult.INVALID_EMAIL) { msg = "That email address doesn't make sense to us =( Please try again."; } else { msg = "Something went wrong while creating your account =( Please try again."; } //Show message box and return to previous screen ctrl.ShowMessageDialog("Uh-oh", msg, () => { ctrl.StartBackTransition(); }); yield break; } //Store authentication key if (call.ResponseData["authKey"] != null) { string authKey = (string)call.ResponseData["authKey"]; ctrl.StoreGuestAuthenticationKey(authKey); } //Continue to auth completed screen ctrl.AuthenticationCompleted(); } finally { ctrl.EnableInput(); } }