/// <summary> /// /// </summary> /// <returns></returns> public async Task SignInAsync() { var signInResult = await m_user.SignInSilentlyAsync(); if (signInResult.Status == SignInStatus.UserInteractionRequired) { signInResult = await m_user.SignInAsync(); } if (signInResult.Status == SignInStatus.Success) { this.OnPropertyChanged("User"); StatsManager.Instance.AddLocalUser(m_user); await SocialManager.Instance.AddLocalUser(this.m_user, SocialManagerExtraDetailLevel.None); ulong userId = ulong.Parse(m_user.XboxUserId); var group = SocialManager.Instance.CreateSocialUserGroupFromList(m_user, new List <ulong> { userId }); m_profile = group.GetUser(userId); this.OnPropertyChanged("Profile"); m_gamerpic = new BitmapImage(new Uri(m_profile.DisplayPicRaw)); this.OnPropertyChanged("Gamerpic"); m_context = new XboxLiveContext(m_user); m_signedIn = true; } }
private void LogFriend(XboxSocialUser socialUser) { LogLine("Gamertag: " + socialUser.Gamertag + ". Status: " + socialUser.PresenceRecord.UserState.ToString()); // Get information on what the user is playing. A user may have presence on multiple devices and titles. foreach (SocialManagerPresenceTitleRecord titleRecord in socialUser.PresenceRecord.PresenceTitleRecords) { LogLine(" Title: " + titleRecord.TitleId + " Presence: " + titleRecord.PresenceText); } }
private void SocialManagerEventProcessed(object sender, SocialEvent socialEvent) { if (socialEvent.EventType == SocialEventType.LocalUserAdded) { socialAddedLocalUser = true; this.Refresh(); } else if (socialEvent.EventType == SocialEventType.SocialUserGroupLoaded) //&& ((SocialUserGroupLoadedEventArgs)socialEvent.EventArgs).SocialUserGroup == this.userGroup //TODO { var entries = this.contentPanel.GetComponentsInChildren <LeaderboardEntry>(); for (int i = 0; i < entries.Length; i++) { XboxSocialUser user = userGroup.Users.FirstOrDefault(x => x.Gamertag == entries[i].gamertagText.text); if (user != null) { entries[i].GamerpicUrl = user.DisplayPicUrlRaw + "&w=128"; } } } }
private void SocialManagerEventProcessed(object sender, SocialEvent socialEvent) { if (socialEvent.EventType == SocialEventType.LocalUserAdded) { socialAddedLocalUser = true; this.Refresh(); } else if (socialEvent.EventType == SocialEventType.SocialUserGroupLoaded && ((SocialUserGroupLoadedEventArgs)socialEvent.EventArgs).SocialUserGroup == this.userGroup) { var entries = this.contentPanel.GetComponentsInChildren <PlayerProfile>(); for (int i = 0; i < entries.Length; i++) { XboxSocialUser user = userGroup.Users.FirstOrDefault(x => x.Gamertag == entries[i].GamerTagText.text); if (user != null) { this.StartCoroutine(entries[i].LoadGamerpic(user.DisplayPicRaw + "&w=128")); } } } }