/// Called when the ChilliConnect login call has completed using the stored /// id and secret but after the player has already signed into FB. We then need /// to link the accounts. /// /// NOTE: This is a bit of an edge case. /// private void OnChilliConnectAnonLoggedInPostFB() { Debug.Log("ChilliConnect logged in anonymously post FB"); m_chilliId = PlayerPrefs.GetString("CCId"); LinkFacebookAccountRequestDesc requestDesc = new LinkFacebookAccountRequestDesc(m_fbAccessToken); m_chilliConnect.PlayerAccounts.LinkFacebookAccount(requestDesc, (request, linkResponse) => OnChilliConnectLinked(linkResponse), (request, linkError) => Debug.LogError(linkError.ErrorDescription)); }
/// Called when the ChilliConnect login call has failed. This could mean either /// a general error or that the FB player has no ChilliConnect account. In the latter /// case we link the current anonymous account to the current FB account. /// /// @param error /// Error type and description /// private void OnChilliConnectFBLoginFailed(LogInUsingFacebookError error) { Debug.LogWarning("ChilliConnect logged in failed. Reason: " + error.ErrorDescription); //An edge case that is probably not even possible is that the player has never created a //ChilliConnect but has managed to login to FB. In this case we just create the account //now and link to that. if (IsChilliLoggedIn() == false) { var requestDesc = new CreatePlayerRequestDesc(); m_chilliConnect.PlayerAccounts.CreatePlayer(requestDesc, (request, response) => OnChilliConnectAccountCreatedPostFB(response), (request, createError) => Debug.LogError(createError.ErrorDescription)); } else if (error.ErrorCode == LogInUsingFacebookError.Error.LoginNotFound) { LinkFacebookAccountRequestDesc requestDesc = new LinkFacebookAccountRequestDesc(m_fbAccessToken); m_chilliConnect.PlayerAccounts.LinkFacebookAccount(requestDesc, (request, linkResponse) => OnChilliConnectLinked(linkResponse), (request, linkError) => Debug.LogError(linkError.ErrorDescription)); } }