Пример #1
0
        void HandleInitializedCallback(SocialCallbackArgs args)
        {
            //if we are already logged in, do nothing
            if (Status == LoginStatus.LoggedIn)
            {
                return;
            }

            //if any of the providers are still initializing, do nothing
            foreach (var key in m_providers.Keys)
            {
                if (m_providers[key].Status == LoginStatus.Processing)
                {
                    return;
                }
            }

            //if all providers are initialized, set the status
            Status = LoginStatus.LoggedOut;
        }
        void HandleLoginCallback(ILoginResult result, Action <SocialCallbackArgs> loginCallback)
        {
            SocialResult socialResult = SocialResult.Success;

            if (result.Cancelled)
            {
                Status       = LoginStatus.LoggedOut;
                socialResult = SocialResult.Cancelled;
            }
            else if (!string.IsNullOrEmpty(result.Error))
            {
                Status       = LoginStatus.LoggedOut;
                socialResult = SocialResult.Failure;
                Debug.LogError(result.Error);
            }

            Status = FB.IsLoggedIn ? LoginStatus.LoggedIn : LoginStatus.LoggedOut;

            if (loginCallback != null)
            {
                var args = new SocialCallbackArgs(this, socialResult, result.Error);
                loginCallback(args);
            }
        }