private void OnAccountRegisterFailure(uint status, object cookie)
        {
            RegisterExternalAccountCommand registerExternalAccountCommand = (RegisterExternalAccountCommand)cookie;
            Lang   lang    = Service.Get <Lang>();
            string title   = lang.Get("ACCOUNT_SYNC_ERROR", new object[0]);
            string message = null;

            if (status == 1318u)
            {
                switch (registerExternalAccountCommand.RequestArgs.Provider)
                {
                case AccountProvider.FACEBOOK:
                    message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_FACEBOOK", new object[0]);
                    break;

                case AccountProvider.GAMECENTER:
                    message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_GAMECENTER", new object[0]);
                    break;

                case AccountProvider.GOOGLEPLAY:
                    message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_GOOGLEPLAY", new object[0]);
                    break;
                }
                ProcessingScreen.Hide();
                AlertScreen.ShowModal(false, title, message, null, null);
                return;
            }
            if (status == 2200u)
            {
                ProcessingScreen.Hide();
                AccountSyncScreen screen = AccountSyncScreen.CreateSyncConflictScreen(registerExternalAccountCommand);
                Service.Get <ScreenController>().AddScreen(screen);
                return;
            }
            if (status != 2201u)
            {
                return;
            }
            switch (registerExternalAccountCommand.RequestArgs.Provider)
            {
            case AccountProvider.FACEBOOK:
                if (this.externalAccountInfo.FacebookAccountId != null && this.externalAccountInfo.FacebookAccountId != FacebookManager.Instance.getUserId())
                {
                    message = lang.Get("ACCOUNT_SYNC_ERROR_FACEBOOK", new object[0]);
                }
                else if (this.externalAccountInfo.FacebookAccountId != null)
                {
                    message = lang.Get("ACCOUNT_SYNC_ERROR_FACEBOOK", new object[0]);
                }
                break;

            case AccountProvider.GAMECENTER:
                if (this.externalAccountInfo.GameCenterAccountId != null && this.externalAccountInfo.GameCenterAccountId != GameServicesManager.GetUserId())
                {
                    message = lang.Get("ACCOUNT_SYNC_ERROR_GAMECENTER", new object[0]);
                }
                else if (this.externalAccountInfo.FacebookAccountId != null)
                {
                    message = lang.Get("ACCOUNT_SYNC_ERROR_GAMECENTER_FACEBOOK", new object[0]);
                }
                break;

            case AccountProvider.GOOGLEPLAY:
                if (this.externalAccountInfo.GooglePlayAccountId != null && this.externalAccountInfo.GooglePlayAccountId != GameServicesManager.GetUserId())
                {
                    message = lang.Get("ACCOUNT_SYNC_ERROR_GOOGLEPLAY", new object[0]);
                }
                else if (this.externalAccountInfo.FacebookAccountId != null)
                {
                    message = lang.Get("ACCOUNT_SYNC_ERROR_GOOGLEPLAY_FACEBOOK", new object[0]);
                }
                break;
            }
            ProcessingScreen.Hide();
            AlertScreen.ShowModal(false, title, message, null, null);
        }
Exemple #2
0
        private void OnAccountRegisterFailure(uint status, object cookie)
        {
            RegisterExternalAccountCommand registerExternalAccountCommand = (RegisterExternalAccountCommand)cookie;
            Lang   lang    = Service.Lang;
            string title   = lang.Get("ACCOUNT_SYNC_ERROR", new object[0]);
            string message = null;
            string derivedExternalAccountId = registerExternalAccountCommand.ResponseResult.DerivedExternalAccountId;

            if (status != 2200u)
            {
                if (status != 2201u)
                {
                    if (status == 1318u)
                    {
                        switch (registerExternalAccountCommand.RequestArgs.Provider)
                        {
                        case AccountProvider.FACEBOOK:
                            message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_FACEBOOK", new object[0]);
                            break;

                        case AccountProvider.GAMECENTER:
                            message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_GAMECENTER", new object[0]);
                            break;

                        case AccountProvider.GOOGLEPLAY:
                            message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_GOOGLEPLAY", new object[0]);
                            break;

                        case AccountProvider.RECOVERY:
                            message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_RECOVERY", new object[0]);
                            break;
                        }
                        ProcessingScreen.Hide();
                        AlertScreen.ShowModal(false, title, message, null, null);
                    }
                }
                else
                {
                    switch (registerExternalAccountCommand.RequestArgs.Provider)
                    {
                    case AccountProvider.FACEBOOK:
                        if (this.externalAccountInfo.DerivedFacebookAccountId != null && this.externalAccountInfo.DerivedFacebookAccountId != derivedExternalAccountId)
                        {
                            message = lang.Get("ACCOUNT_SYNC_ERROR_FACEBOOK", new object[0]);
                        }
                        else if (this.externalAccountInfo.DerivedGooglePlayAccountId != null)
                        {
                            message = lang.Get("ACCOUNT_SYNC_ERROR_FACEBOOK_GOOGLEPLAY", new object[0]);
                        }
                        break;

                    case AccountProvider.GAMECENTER:
                        if (this.externalAccountInfo.DerivedGameCenterAccountId != null && this.externalAccountInfo.DerivedGameCenterAccountId != derivedExternalAccountId)
                        {
                            message = lang.Get("ACCOUNT_SYNC_ERROR_GAMECENTER", new object[0]);
                        }
                        else if (this.externalAccountInfo.DerivedFacebookAccountId != null)
                        {
                            message = lang.Get("ACCOUNT_SYNC_ERROR_GAMECENTER_FACEBOOK", new object[0]);
                        }
                        break;

                    case AccountProvider.GOOGLEPLAY:
                        if (this.externalAccountInfo.DerivedGooglePlayAccountId != null && this.externalAccountInfo.DerivedGooglePlayAccountId != derivedExternalAccountId)
                        {
                            message = lang.Get("ACCOUNT_SYNC_ERROR_GOOGLEPLAY", new object[0]);
                        }
                        else if (this.externalAccountInfo.DerivedFacebookAccountId != null)
                        {
                            message = lang.Get("ACCOUNT_SYNC_ERROR_GOOGLEPLAY_FACEBOOK", new object[0]);
                        }
                        break;

                    case AccountProvider.RECOVERY:
                        message = lang.Get("ACCOUNT_SYNC_ERROR_RECOVERY", new object[0]);
                        break;
                    }
                    ProcessingScreen.Hide();
                    AlertScreen.ShowModal(false, title, message, null, null);
                }
            }
            else
            {
                ProcessingScreen.Hide();
                AccountSyncScreen accountSyncScreen = AccountSyncScreen.CreateSyncConflictScreen(registerExternalAccountCommand);
                if (registerExternalAccountCommand.RequestArgs.Provider == AccountProvider.RECOVERY)
                {
                    accountSyncScreen.OverrideDescription(lang.Get("ACCOUNT_SYNC_CONFLICT_RECOVERY", new object[0]));
                }
                Service.ScreenController.AddScreen(accountSyncScreen);
            }
        }