示例#1
0
    // Token: 0x060061A1 RID: 24993 RVA: 0x002273B4 File Offset: 0x002257B4
    protected override void FetchAndRenderElements(int page)
    {
        List <ApiModel> am = new List <ApiModel>();

        switch (this.listType)
        {
        case UiUserList.ListType.InWorld:
            if (RoomManager.inRoom)
            {
                Player[]      allPlayers    = PlayerManager.GetAllPlayers();
                List <string> inRoomUserIds = (from p in allPlayers
                                               select p.userId).ToList <string>();
                PlayerManager.FetchUsersInWorldInstance(delegate(List <APIUser> users)
                {
                    foreach (APIUser apiuser in users)
                    {
                        Player player = PlayerManager.GetPlayer(apiuser.id);
                        bool flag     = player != null && player.vrcPlayer != null && player.vrcPlayer.isInvisible;
                        if (inRoomUserIds.Contains(apiuser.id) && !flag)
                        {
                            am.Add(apiuser);
                        }
                    }
                    this.RenderPaginatedUsers(am.Cast <APIUser>().ToList <APIUser>(), page);
                }, delegate(string message)
                {
                    Debug.LogError("Could not fetch users in current world - " + message);
                });
            }
            break;

        case UiUserList.ListType.FriendRequests:
            ApiNotification.FetchAll(ApiNotification.NotificationType.Friendrequest, false, string.Empty, delegate(List <ApiNotification> notifications)
            {
                foreach (ApiNotification item in notifications)
                {
                    am.Add(item);
                }
                this.RenderPaginatedNotifs(am.Cast <ApiNotification>().ToList <ApiNotification>(), page);
            }, delegate(string message)
            {
                Debug.LogError("Could not fetch users in current world - " + message);
            });
            break;

        case UiUserList.ListType.OnlineFriends:
            APIUser.FetchFriends(delegate(List <APIUser> users)
            {
                foreach (APIUser apiuser in users)
                {
                    Player player = PlayerManager.GetPlayer(apiuser.id);
                    bool flag     = player != null && player.vrcPlayer != null && player.vrcPlayer.isInvisible;
                    if (apiuser.location != "offline" && !flag)
                    {
                        am.Add(apiuser);
                    }
                }
                this.RenderPaginatedUsers(am.Cast <APIUser>().ToList <APIUser>(), page);
            }, delegate(string message)
            {
                Debug.LogError("Could not fetch users in current world - " + message);
            });
            break;

        case UiUserList.ListType.OfflineFriends:
            APIUser.FetchFriends(delegate(List <APIUser> users)
            {
                foreach (APIUser apiuser in users)
                {
                    Player player = PlayerManager.GetPlayer(apiuser.id);
                    bool flag     = player != null && player.vrcPlayer != null && player.vrcPlayer.isInvisible;
                    if (apiuser.location == "offline" || flag)
                    {
                        am.Add(apiuser);
                    }
                }
                this.RenderPaginatedUsers(am.Cast <APIUser>().ToList <APIUser>(), page);
            }, delegate(string message)
            {
                Debug.LogError("Could not fetch users in current world - " + message);
            });
            break;

        case UiUserList.ListType.HelpRequests:
            ApiNotification.FetchAll(ApiNotification.NotificationType.Halp, false, string.Empty, delegate(List <ApiNotification> notifications)
            {
                foreach (ApiNotification item in notifications)
                {
                    am.Add(item);
                }
                this.RenderPaginatedNotifs(am.Cast <ApiNotification>().ToList <ApiNotification>(), page);
            }, delegate(string message)
            {
                Debug.LogError("Could not fetch users in current world - " + message);
            });
            break;

        case UiUserList.ListType.Search:
            APIUser.FetchUsers(this.searchQuery, delegate(List <APIUser> users)
            {
                foreach (APIUser item in users)
                {
                    am.Add(item);
                }
                this.RenderPaginatedUsers(am.Cast <APIUser>().ToList <APIUser>(), page);
            }, delegate(string message)
            {
                Debug.LogError("Could not fetch users in current world - " + message);
            });
            break;
        }
    }