protected override void OnBackButtonPressed() { CoroutineRunner.Instance.StartCoroutine(LeaveGameCoroutine()); IEnumerator LeaveGameCoroutine() { if (this.isLeaveGameCoroutineRunning) { yield break; } this.isLeaveGameCoroutineRunning = true; this.Dialog.Hide(); yield return(WaitForUtil.Seconds(0.25f)); var leaveGamePrompt = PlayFabMessages.ShowExitAppPrompt(); yield return(leaveGamePrompt); if (leaveGamePrompt.Value == YesNoResult.Yes) { Platform.QuitApplication(); yield break; } this.Dialog.Show(); this.isLeaveGameCoroutineRunning = false; } }
private void ForgotPassword() { CoroutineRunner.Instance.StartCoroutine(ForgotPasswordCoroutine()); IEnumerator ForgotPasswordCoroutine() { if (this.isForgotPasswordCoroutineRunning) { yield break; } this.isForgotPasswordCoroutineRunning = true; this.Dialog.Hide(); yield return(WaitForUtil.Seconds(.25f)); var forgot = PlayFabMessages.ShowForgotPasswordPrompt(this.emailInputField.text); if (forgot.Value == YesNoResult.Yes) { var accountRecovery = this.loginManager.SendAccountRecoveryEmail(this.emailInputField.text, this.forgotEmailTemplateId); yield return(accountRecovery); if (accountRecovery.HasError) { yield return(PlayFabMessages.HandleError(accountRecovery.Exception)); } } this.Dialog.Show(); this.isForgotPasswordCoroutineRunning = false; } }
private void LogIn() { CoroutineRunner.Instance.StartCoroutine(LogInCoroutine()); IEnumerator LogInCoroutine() { if (this.isLoginCoroutineRunning) { yield break; } this.isLoginCoroutineRunning = true; var login = this.loginManager.LoginWithEmailAddress(this.emailInputField.text, this.passwordInputField.text, this.infoRequestParams); yield return(login); if (login.HasError) { yield return(PlayFabMessages.HandleError(login.Exception)); } else { this.loginManager.LastLoginEmail = this.emailInputField.text; this.loginManager.AutoLoginWithDeviceId = this.autoLoginToggle.isOn; string customId = this.loginManager.GetEmailCustomId(this.emailInputField.text); if (this.loginManager.AutoLoginWithDeviceId && this.loginManager.IsCustomIdLinked(customId) == false) { this.loginManager.LinkDeviceId(this.loginManager.DeviceId); } this.Dialog.Hide(); } this.isLoginCoroutineRunning = false; } }
private void SignIn() { CoroutineRunner.Instance.StartCoroutine(SignInCoroutine()); IEnumerator SignInCoroutine() { if (this.isSignUpCoroutineRunning) { yield break; } this.isSignUpCoroutineRunning = true; var register = this.loginManager.RegisterPlayFabUser(this.emailInputField.text, this.passwordInputField.text); yield return(register); if (register.HasError) { yield return(PlayFabMessages.HandleError(register.Exception)); } else { var login = this.loginManager.LoginWithEmailAddress(this.emailInputField.text, this.passwordInputField.text); yield return(login); if (login.HasError) { yield return(PlayFabMessages.HandleError(login.Exception)); // TODO [bgish]: If email already take, then ask them to retry and continue showing the SignUp dialog } else { this.loginManager.HasEverLoggedIn = true; this.loginManager.LastLoginEmail = this.emailInputField.text; this.loginManager.AutoLoginWithDeviceId = this.autoLoginToggle.isOn; if (this.loginManager.AutoLoginWithDeviceId) { var linkDevice = this.loginManager.LinkDeviceId(this.loginManager.GetEmailCustomId(this.emailInputField.text)); yield return(linkDevice); if (linkDevice.HasError) { yield return(PlayFabMessages.HandleError(linkDevice.Exception)); } } } //// TODO [bgish]: What Do I Do If the Linking is not successful!?!?!?!?! It will fail //// if someone logs out and tries to create another account. this.Dialog.Hide(); } this.isSignUpCoroutineRunning = false; } }