// -------------------------------------------------------------------------------------------- private void LogIn_Enter() { List <SessionProvider> sessionProviders = new List <SessionProvider>() { new UnityDeviceIdSessionProvider(), }; _authenticationManager = new PlayFabAccountAuthenticationManager(sessionProviders, SystemInfo.deviceUniqueIdentifier, AppConsts.PlayFab.TitleID); _authenticationManager.Authenticate(() => { Debug.Log("Authenticated succesfully!"); _stateMachine.ChangeState(State.LoadAssets); }, (TofuError errorCode, string errorMessage) => { Debug.LogErrorFormat("Could not authenticate with PlayFab, code {0}: {1}", errorCode, errorMessage); }); }
// -------------------------------------------------------------------------------------------- /// <summary> /// Log in to the local player's account. /// </summary> public void LogIn(AccountAuthenticationManager.AuthenticationSuccessDelegate onSuccess, AccountAuthenticationManager.AuthenticationFailureDelegate onFailure) { _authenticationManager = new PlayFabAccountAuthenticationManager( new List <SessionProvider> { new UnityDeviceIdSessionProvider() }, SystemInfo.deviceUniqueIdentifier, AppConsts.PlayFab.TitleID); _authenticationManager.Authenticate(() => { _accountData = _authenticationManager.AccountData; AuthenticatedSuccessfully?.Invoke(this, new AuthenticatedSuccessfullyEventArgs(_accountData)); onSuccess(); }, (TofuErrorCode errorCode, string errorMessage) => { FailedToAuthenticate?.Invoke(this, EventArgs.Empty); onFailure(errorCode, errorMessage); }); }