Пример #1
0
 // Token: 0x06006048 RID: 24648 RVA: 0x0021E874 File Offset: 0x0021CC74
 public void AcceptFriendRequest()
 {
     ModerationManager.Instance.UnmuteUser(this.notification.senderUserId);
     ModerationManager.Instance.UnblockUser(this.notification.senderUserId);
     APIUser.AcceptFriendRequest(this.notification.id, null, delegate(string obj)
     {
         Debug.LogError("Something went wrong accepting friend request");
         this.SetupUserInfo(this.user, PageUserInfo.InfoType.ReceivedFriendRequest, UiUserList.ListType.None);
     });
     PageUserInfo.InfoType infoType = (!(this.user.location == "offline")) ? PageUserInfo.InfoType.OnlineFriend : PageUserInfo.InfoType.OfflineFriend;
     this.SetupUserInfo(this.user, infoType, UiUserList.ListType.None);
 }
Пример #2
0
        // Token: 0x06006043 RID: 24643 RVA: 0x0021E5C0 File Offset: 0x0021C9C0
        public void SetUserRelationshipState(PageUserInfo.InfoType relationshipState)
        {
            this.state = relationshipState;
            this.userButtons.SetActive(false);
            this.sentFriendRequestButtons.SetActive(false);
            this.receivedFriendRequestButtons.SetActive(false);
            this.onlineFriendButtons.SetActive(false);
            this.offlineFriendButtons.SetActive(false);
            this.invitationButtons.SetActive(false);
            switch (this.state)
            {
            case PageUserInfo.InfoType.NotFriends:
                this.userButtons.SetActive(true);
                break;

            case PageUserInfo.InfoType.OnlineFriend:
                this.onlineFriendButtons.SetActive(true);
                break;

            case PageUserInfo.InfoType.OfflineFriend:
                this.offlineFriendButtons.SetActive(true);
                break;

            case PageUserInfo.InfoType.SentFriendRequest:
                this.sentFriendRequestButtons.SetActive(true);
                break;

            case PageUserInfo.InfoType.ReceivedFriendRequest:
                this.receivedFriendRequestButtons.SetActive(true);
                break;

            case PageUserInfo.InfoType.Invited:
                this.invitationButtons.SetActive(true);
                break;
            }
        }
Пример #3
0
        // Token: 0x0600603A RID: 24634 RVA: 0x0021DD74 File Offset: 0x0021C174
        public void SetupUserInfo(APIUser u, PageUserInfo.InfoType infoType, UiUserList.ListType listType = UiUserList.ListType.None)
        {
            this.SetUserRelationshipState(infoType);
            this.ClearRoomInfo();
            this.user          = u;
            this.userName.text = this.user.displayName;
            if (!string.IsNullOrEmpty(this.user.currentAvatarImageUrl))
            {
                Downloader.DownloadImage(this.user.currentAvatarImageUrl, delegate(string downloadedUrl, Texture2D obj)
                {
                    this.avatarImage.texture = obj;
                }, string.Empty);
            }
            this.SetupModButtons();
            this.onlineStatusText.text = string.Empty;
            switch (this.state)
            {
            case PageUserInfo.InfoType.NotFriends:
            {
                this.worldImage.transform.parent.gameObject.SetActive(true);
                Player player = PlayerManager.GetPlayer(this.user.id);
                bool   flag   = player != null && player.vrcPlayer != null && player.vrcPlayer.isInvisible;
                if (listType == UiUserList.ListType.InWorld && !flag)
                {
                    if (RoomManager.currentRoom != null && !string.IsNullOrEmpty(RoomManager.currentRoom.imageUrl))
                    {
                        this.DownloadAndSetWorldImage(RoomManager.currentRoom.imageUrl);
                    }
                    this.onlineStatusText.text = "online in current world";
                }
                this.SetupFriendButton("Friend");
                break;
            }

            case PageUserInfo.InfoType.OnlineFriend:
                this.worldImage.transform.parent.gameObject.SetActive(true);
                this.worldList.ownerId = this.user.id;
                this.worldScroller.SetActive(true);
                this.SetIcon(QuickMenuSocialElement.IconType.Friend, u.id);
                this.SetupJoinButton("Join", false);
                this.SetupInviteButton("Invite", false);
                if (listType == UiUserList.ListType.InWorld)
                {
                    if (RoomManager.currentRoom != null && !string.IsNullOrEmpty(RoomManager.currentRoom.imageUrl))
                    {
                        this.DownloadAndSetWorldImage(RoomManager.currentRoom.imageUrl);
                    }
                    this.onlineStatusText.text = "online in current world";
                }
                else if (!string.IsNullOrEmpty(this.user.location))
                {
                    string text = this.user.location.Split(new char[]
                    {
                        ':'
                    })[0];
                    string instanceId = this.user.location.Split(new char[]
                    {
                        ':'
                    })[1];
                    if (text == "local")
                    {
                        this.onlineStatusText.text = "online in local test world";
                    }
                    else
                    {
                        ApiWorld.Fetch(text, delegate(ApiWorld world)
                        {
                            ApiWorld.WorldInstance worldInstance = new ApiWorld.WorldInstance(instanceId, 0);
                            bool flag2 = APIUser.CurrentUser.id == worldInstance.GetInstanceCreator();
                            ApiWorld.WorldInstance.AccessType accessType     = worldInstance.GetAccessType();
                            ApiWorld.WorldInstance.AccessDetail accessDetail = ApiWorld.WorldInstance.GetAccessDetail(accessType);
                            if (accessType == ApiWorld.WorldInstance.AccessType.Public)
                            {
                                this.DownloadAndSetWorldImage(world.imageUrl);
                                this.userLocation = world;
                                if (world.id == RoomManager.currentRoom.id && worldInstance.idWithTags == RoomManager.currentRoom.currentInstanceIdWithTags)
                                {
                                    this.onlineStatusText.text = "online in same world";
                                }
                                else
                                {
                                    this.onlineStatusText.text = string.Concat(new string[]
                                    {
                                        "online in ",
                                        world.name,
                                        "\n<i>",
                                        accessDetail.fullName.ToLower(),
                                        "</i>"
                                    });
                                    this.SetupJoinButton("Join", true);
                                    this.SetupInviteButton("Invite", this.CanInviteHere());
                                }
                            }
                            else if (accessType == ApiWorld.WorldInstance.AccessType.FriendsOfGuests)
                            {
                                this.DownloadAndSetWorldImage(world.imageUrl);
                                this.userLocation = world;
                                if (world.id == RoomManager.currentRoom.id && worldInstance.idWithTags == RoomManager.currentRoom.currentInstanceIdWithTags)
                                {
                                    this.onlineStatusText.text = "online in same world";
                                }
                                else
                                {
                                    this.onlineStatusText.text = string.Concat(new string[]
                                    {
                                        "online in ",
                                        world.name,
                                        "\n<i>",
                                        accessDetail.fullName.ToLower(),
                                        "</i>"
                                    });
                                    this.SetupJoinButton("Join", true);
                                    this.SetupInviteButton("Invite", this.CanInviteHere());
                                }
                            }
                            else if (accessType == ApiWorld.WorldInstance.AccessType.FriendsOnly)
                            {
                                this.DownloadAndSetWorldImage(world.imageUrl);
                                this.userLocation = world;
                                if (world.id == RoomManager.currentRoom.id && worldInstance.idWithTags == RoomManager.currentRoom.currentInstanceIdWithTags)
                                {
                                    this.onlineStatusText.text = "online in same world";
                                }
                                else
                                {
                                    this.onlineStatusText.text = string.Concat(new string[]
                                    {
                                        "online in ",
                                        world.name,
                                        "\n<i>",
                                        accessDetail.fullName.ToLower(),
                                        "</i>"
                                    });
                                    this.SetupJoinButton("Join", flag2 || this.user.id == worldInstance.GetInstanceCreator());
                                    this.SetupInviteButton("Invite", this.CanInviteHere());
                                }
                            }
                            else if (accessType == ApiWorld.WorldInstance.AccessType.InviteOnly)
                            {
                                if (flag2)
                                {
                                    this.DownloadAndSetWorldImage(world.imageUrl);
                                    this.userLocation = world;
                                }
                                else
                                {
                                    this.worldImage.texture = this.avatarImage.texture;
                                    this.userLocation       = null;
                                }
                                if (world.id == RoomManager.currentRoom.id && worldInstance.idWithTags == RoomManager.currentRoom.currentInstanceIdWithTags)
                                {
                                    this.onlineStatusText.text = "online in same world";
                                }
                                else
                                {
                                    this.onlineStatusText.text = "online in " + accessDetail.fullName.ToLower() + " world";
                                    if (flag2)
                                    {
                                        this.SetupJoinButton("Join", true);
                                    }
                                    else
                                    {
                                        this.SetupJoinButton("Req Invite", this.user.id == worldInstance.GetInstanceCreator());
                                    }
                                    this.SetupInviteButton("Invite", this.CanInviteHere());
                                }
                            }
                        }, delegate(string obj)
                        {
                            Debug.LogError(obj);
                        });
                    }
                }
                break;

            case PageUserInfo.InfoType.OfflineFriend:
                this.onlineStatusText.text = "offline";
                this.worldList.ownerId     = this.user.id;
                this.worldScroller.SetActive(true);
                this.SetIcon(QuickMenuSocialElement.IconType.Friend, u.id);
                break;

            case PageUserInfo.InfoType.ReceivedFriendRequest:
                this.notificationMessageText.text = this.user.displayName + " wants to be your friend";
                this.SetIcon(QuickMenuSocialElement.IconType.FriendRequest, u.id);
                break;

            case PageUserInfo.InfoType.ReceivedHelpRequest:
                this.notificationMessageText.text = this.user.displayName + " needs help";
                this.SetIcon(QuickMenuSocialElement.IconType.HelpRequest, u.id);
                break;
            }
            this.SetupBlockButton();
            this.SetupVoteToKickButton();
            this.SetupMuteButton();
        }
Пример #4
0
    // Token: 0x060061A4 RID: 24996 RVA: 0x002275B8 File Offset: 0x002259B8
    protected override void SetPickerContentFromApiModel(VRCUiContentButton content, object am)
    {
        APIUser user = null;

        content.SetDetailShouldShowImage(0, false);
        content.SetDetailShouldShowImage(1, false);
        content.SetDetailShouldShowImage(2, false);
        if (am is ApiNotification)
        {
            ApiNotification notif = (ApiNotification)am;
            user = new APIUser();
            user.Init(notif);
            content.Initialize(user.currentAvatarThumbnailImageUrl, user.displayName, null, notif.id);
            APIUser.Fetch(notif.senderUserId, delegate(APIUser u)
            {
                content.Initialize(u.currentAvatarThumbnailImageUrl, u.displayName, delegate
                {
                    VRCUiPage page = VRCUiManager.Instance.GetPage("UserInterface/MenuContent/Screens/UserInfo");
                    VRCUiManager.Instance.ShowScreen(page);
                    ((PageUserInfo)page).SetupUserInfo(u, PageUserInfo.InfoType.ReceivedFriendRequest, UiUserList.ListType.None);
                    ((PageUserInfo)page).notification = notif;
                }, notif.id);
            }, null);
        }
        else
        {
            user = (APIUser)am;
            content.Initialize(user.currentAvatarThumbnailImageUrl, user.displayName, delegate
            {
                PageUserInfo.InfoType infoType = PageUserInfo.InfoType.NotFriends;
                VRCUiPage page = VRCUiManager.Instance.GetPage("UserInterface/MenuContent/Screens/UserInfo");
                VRCUiManager.Instance.ShowScreen(page);
                bool flag = false;
                if (APIUser.CurrentUser.friends != null)
                {
                    flag = (APIUser.CurrentUser.friends.Find((APIUser u) => u.id == user.id) != null);
                }
                switch (this.listType)
                {
                case UiUserList.ListType.InWorld:
                    if (flag)
                    {
                        infoType = PageUserInfo.InfoType.OnlineFriend;
                    }
                    else
                    {
                        infoType = PageUserInfo.InfoType.NotFriends;
                    }
                    break;

                case UiUserList.ListType.FriendRequests:
                    infoType = PageUserInfo.InfoType.ReceivedFriendRequest;
                    break;

                case UiUserList.ListType.OnlineFriends:
                    infoType = PageUserInfo.InfoType.OnlineFriend;
                    break;

                case UiUserList.ListType.OfflineFriends:
                    infoType = PageUserInfo.InfoType.OfflineFriend;
                    break;

                case UiUserList.ListType.Invites:
                    infoType = PageUserInfo.InfoType.Invited;
                    break;

                case UiUserList.ListType.HelpRequests:
                    infoType = PageUserInfo.InfoType.ReceivedHelpRequest;
                    break;

                case UiUserList.ListType.Search:
                    {
                        Player player = PlayerManager.GetPlayer(user.id);
                        bool flag2    = player != null && player.vrcPlayer != null && player.vrcPlayer.isInvisible;
                        if (flag)
                        {
                            infoType = ((!flag2) ? PageUserInfo.InfoType.OnlineFriend : PageUserInfo.InfoType.OfflineFriend);
                        }
                        else
                        {
                            infoType = PageUserInfo.InfoType.NotFriends;
                        }
                        break;
                    }
                }
                ((PageUserInfo)page).SetupUserInfo(user, infoType, this.listType);
            }, user.id);
        }
        if (this.listType == UiUserList.ListType.FriendRequests)
        {
            content.SetDetailShouldShowImage(2, true);
        }
        else if (ModerationManager.Instance.IsBlocked(user.id))
        {
            content.SetDetailShouldShowImage(1, true);
        }
        else if (APIUser.IsFriendsWith(user.id))
        {
            content.SetDetailShouldShowImage(0, true);
        }
    }