private void RegisterGameServicesAccount() { string userId = GameServicesManager.GetUserId(); if (string.IsNullOrEmpty(userId)) { return; } if (this.externalAccountInfo == null) { this.gameServicesRegisterPending = true; return; } string text = null; if (text == userId) { return; } string authToken = GameServicesManager.GetAuthToken(); if (string.IsNullOrEmpty(authToken)) { return; } this.RegisterExternalAccount(new RegisterExternalAccountRequest { OverrideExistingAccountRegistration = false, ExternalAccountId = userId, ExternalAccountSecurityToken = authToken, PlayerId = Service.Get <CurrentPlayer>().PlayerId, OtherLinkedProvider = AccountProvider.FACEBOOK }); }
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); }