// Token: 0x06006108 RID: 24840 RVA: 0x00223CC0 File Offset: 0x002220C0 public void SetupElement(ApiNotification n, QuickMenuSocialElement.IconType icon = QuickMenuSocialElement.IconType.None) { APIUser cachedUser = APIUser.GetCachedUser(n.senderUserId); if (cachedUser != null) { this.SetupElement(cachedUser, QuickMenuSocialElement.IconType.None); this.SetIcon(icon, cachedUser.id); this.notification = n; this.elementType = QuickMenuSocialElement.ElementType.Notification; } else { APIUser.Fetch(n.senderUserId, delegate(APIUser user) { this.SetupElement(user, QuickMenuSocialElement.IconType.None); this.SetIcon(icon, user.id); this.notification = n; this.elementType = QuickMenuSocialElement.ElementType.Notification; }, delegate(string obj) { Debug.LogError(obj); }); } }
// Token: 0x060060FE RID: 24830 RVA: 0x00223654 File Offset: 0x00221A54 public Texture GetSocialIcon(QuickMenuSocialElement.IconType iconType) { Texture result = null; if (iconType > QuickMenuSocialElement.IconType.None) { result = this.socialIcons[(int)iconType]; } return(result); }
// Token: 0x06006102 RID: 24834 RVA: 0x002236E0 File Offset: 0x00221AE0 private void SetupNotifications() { Action <List <ApiNotification> > SetupNotifs = delegate(List <ApiNotification> notifs) { List <ApiNotification> notificationsOfType4 = NotificationManager.Instance.GetNotificationsOfType(ApiNotification.NotificationType.VoteToKick, NotificationManager.HistoryRange.Local); notifs.AddRange(notificationsOfType4); int num = 0; for (int i = 0; i < this.elements.Length; i++) { if (num < notifs.Count) { ApiNotification apiNotification = notifs[num]; if (apiNotification.notificationType == ApiNotification.NotificationType.Friendrequest) { apiNotification.message = apiNotification.senderUsername + " would like to be your friend"; } if (this.elements[i].elementType == QuickMenuSocialElement.ElementType.Empty || this.elements[i].elementType == QuickMenuSocialElement.ElementType.Notification) { QuickMenuSocialElement.IconType iconTypeForNotificationType = QuickMenuSocialElement.GetIconTypeForNotificationType(apiNotification.notificationType); this.elements[i].SetupElement(apiNotification, iconTypeForNotificationType); num++; } } } }; List <ApiNotification> priority = NotificationManager.Instance.GetNotificationsOfType(ApiNotification.NotificationType.Halp, NotificationManager.HistoryRange.Recent); List <ApiNotification> notificationsOfType = NotificationManager.Instance.GetNotificationsOfType(ApiNotification.NotificationType.Invite, NotificationManager.HistoryRange.Recent); List <ApiNotification> notificationsOfType2 = NotificationManager.Instance.GetNotificationsOfType(ApiNotification.NotificationType.Requestinvite, NotificationManager.HistoryRange.Recent); List <ApiNotification> notificationsOfType3 = NotificationManager.Instance.GetNotificationsOfType(ApiNotification.NotificationType.Friendrequest, NotificationManager.HistoryRange.Recent); priority.AddRange(notificationsOfType); priority.AddRange(notificationsOfType2); priority.AddRange(notificationsOfType3); SetupNotifs(priority); if (this.dontFetchNotificationsForOnePeriod) { this.dontFetchNotificationsForOnePeriod = false; } else { NotificationManager.Instance.FetchNotifications(NotificationManager.HistoryRange.Recent, delegate(List <ApiNotification> notifs) { notifs.RemoveAll((ApiNotification x) => x.notificationType == ApiNotification.NotificationType.Hidden); IEnumerable <string> source = (from x in priority select x.id).Except(from x in notifs select x.id); bool flag = source.Count <string>() > 0 || priority.Count != notifs.Count; if (flag) { SetupNotifs(notifs); } }); } }
// Token: 0x0600610B RID: 24843 RVA: 0x00223DFC File Offset: 0x002221FC private void SetIcon(QuickMenuSocialElement.IconType icon, string userId) { this.currentIcon = icon; if (icon == QuickMenuSocialElement.IconType.None) { this.iconImage.gameObject.SetActive(false); } else { this.iconImage.gameObject.SetActive(true); Texture socialIcon = QuickMenuSocial.Instance.GetSocialIcon(icon); this.iconImage.texture = socialIcon; } }
// Token: 0x06006059 RID: 24665 RVA: 0x0021EC14 File Offset: 0x0021D014 private void SetIcon(QuickMenuSocialElement.IconType icon, string userId) { if (!string.IsNullOrEmpty(userId)) { if (icon == QuickMenuSocialElement.IconType.None || icon == QuickMenuSocialElement.IconType.Friend) { if (ModerationManager.Instance.IsBlocked(userId)) { icon = QuickMenuSocialElement.IconType.Blocked; } else if (APIUser.IsFriendsWith(userId)) { icon = QuickMenuSocialElement.IconType.Friend; } } if (icon == QuickMenuSocialElement.IconType.Blocked && !ModerationManager.Instance.IsBlocked(userId)) { if (APIUser.IsFriendsWith(userId)) { icon = QuickMenuSocialElement.IconType.Friend; } else { icon = QuickMenuSocialElement.IconType.None; } } } else { icon = QuickMenuSocialElement.IconType.None; } this.currentIcon = icon; Texture socialIcon = QuickMenuSocial.Instance.GetSocialIcon(icon); if (socialIcon != null) { this.iconImage.gameObject.SetActive(true); this.iconImage.texture = socialIcon; } else { this.iconImage.gameObject.SetActive(false); } }
// Token: 0x06006107 RID: 24839 RVA: 0x00223C1C File Offset: 0x0022201C public void SetupElement(APIUser u, QuickMenuSocialElement.IconType icon = QuickMenuSocialElement.IconType.None) { base.gameObject.SetActive(true); this.ClearElement(); this.user = u; this.userName.text = this.user.displayName; this.SetIcon(icon, u.id); if (!string.IsNullOrEmpty(this.user.currentAvatarThumbnailImageUrl)) { Downloader.DownloadImage(u.currentAvatarThumbnailImageUrl, delegate(string downloadedUrl, Texture2D obj) { if (u.currentAvatarThumbnailImageUrl == downloadedUrl) { this.image.texture = obj; } }, string.Empty); } this.elementType = QuickMenuSocialElement.ElementType.User; }