void Login() { Debug.Log("Login Path: " + this.loginPathToUse); switch (this.loginPathToUse) { case PlayFabLoginCalls.LoginPathways.pf_username: PlayFabLoginCalls.RequestSpinner(); PlayFabLoginCalls.LoginWithUsername(this.accountInfo.Username, this.password.text); break; case PlayFabLoginCalls.LoginPathways.pf_email: PlayFabLoginCalls.RequestSpinner(); PlayFabLoginCalls.LoginWithEmail(this.accountInfo.PrivateInfo.Email, this.password.text); break; case PlayFabLoginCalls.LoginPathways.deviceId: PlayFabLoginCalls.RequestSpinner(); PlayFabLoginCalls.TestDeviceIdHasAccount(); break; case PlayFabLoginCalls.LoginPathways.facebook: this.isCounting = false; PlayFabLoginCalls.RequestSpinner(); PlayFabLoginCalls.StartFacebookLogin(); break; case PlayFabLoginCalls.LoginPathways.gameCenter: this.isCounting = false; PlayFabLoginCalls.RequestSpinner(); PlayFabLoginCalls.StartGameCenterLogin(); break; case PlayFabLoginCalls.LoginPathways.googlePlus: this.isCounting = false; PlayFabLoginCalls.RequestSpinner(); PlayFabLoginCalls.StartGooglePlusLogin(); break; case PlayFabLoginCalls.LoginPathways.steam: Debug.LogWarning("Steam Token Authentication not yet implemented."); break; } }
/// <summary> /// Parses Unity PlayerPrefs for saved login information. See the gitHub readme for more information /// </summary> /// <returns> used for coroutine yielding </returns> IEnumerator ReadLoginDataRecord() { this.status.text = "Finding previous logins..."; if (PlayerPrefs.HasKey("loginMethodUsed")) { this.status.text = "Previous login found... "; string raw = PlayerPrefs.GetString("loginMethodUsed"); PlayFabLoginCalls.LoginPathways method = (PlayFabLoginCalls.LoginPathways)Enum.Parse(typeof(PlayFabLoginCalls.LoginPathways), raw); Debug.Log(method.ToString()); switch (method) { case PlayFabLoginCalls.LoginPathways.pf_username: if (PlayerPrefs.HasKey("accountInfo")) { this.accountInfo = JsonConvert.DeserializeObject <UserAccountInfo>(PlayerPrefs.GetString("accountInfo")); this.createNewAccount = false; PrompForPassword(); this.details.text = string.Format("PlayFab Username: {0} found...", this.accountInfo.Username); this.instructions.text = "Enter password to continue, or change accounts manually by clicking below."; this.loginPathToUse = PlayFabLoginCalls.LoginPathways.pf_username; } break; case PlayFabLoginCalls.LoginPathways.pf_email: if (PlayerPrefs.HasKey("accountInfo")) { this.accountInfo = JsonConvert.DeserializeObject <UserAccountInfo>(PlayerPrefs.GetString("accountInfo")); this.createNewAccount = false; PrompForPassword(); this.details.text = string.Format("Email: {0} found...", this.accountInfo.PrivateInfo.Email); this.instructions.text = "Enter password to continue, or change accounts manually by clicking below."; this.loginPathToUse = PlayFabLoginCalls.LoginPathways.pf_email; } break; case PlayFabLoginCalls.LoginPathways.deviceId: EnableCountdown(); this.createNewAccount = false; this.details.text = "Device Id, click below to manually change accounts"; this.loginPathToUse = PlayFabLoginCalls.LoginPathways.deviceId; break; case PlayFabLoginCalls.LoginPathways.facebook: EnableCountdown(); this.createNewAccount = false; this.details.text = "Facebook, click below to manually change accounts"; this.loginPathToUse = PlayFabLoginCalls.LoginPathways.facebook; break; case PlayFabLoginCalls.LoginPathways.gameCenter: EnableCountdown(); this.createNewAccount = false; this.details.text = "GameCenter, click below to manually change accounts"; this.loginPathToUse = PlayFabLoginCalls.LoginPathways.gameCenter; break; case PlayFabLoginCalls.LoginPathways.googlePlus: EnableCountdown(); this.createNewAccount = false; this.details.text = "Google+, click below to manually change accounts"; this.loginPathToUse = PlayFabLoginCalls.LoginPathways.googlePlus; break; case PlayFabLoginCalls.LoginPathways.steam: EnableCountdown(); this.createNewAccount = false; this.details.text = "Steam, click below to manually change accounts"; this.loginPathToUse = PlayFabLoginCalls.LoginPathways.steam; break; default: AutoNewAccount(); break; } } else { if (PlayFabLoginCalls.CheckForSupportedMobilePlatform()) { AutoNewAccount(); } else { PlayFabLoginCalls.TestDeviceIdHasAccount(); yield return(new WaitForSeconds(.333f)); authController.activeState = AuthenticationController.LoginStates.Manual; } } }