Esempio n. 1
0
    // Token: 0x060061C9 RID: 25033 RVA: 0x00227FC8 File Offset: 0x002263C8
    protected override void SetPickerContentFromApiModel(VRCUiContentButton content, object am)
    {
        ApiWorld.WorldInstance wi = (ApiWorld.WorldInstance)am;
        string detail             = (wi.count <= 0) ? string.Empty : wi.count.ToString();

        ApiWorld.WorldInstance.AccessType   accessType   = wi.GetAccessType();
        ApiWorld.WorldInstance.AccessDetail accessDetail = ApiWorld.WorldInstance.GetAccessDetail(accessType);
        Action action = null;

        if (accessType == ApiWorld.WorldInstance.AccessType.PrivatePopCounter)
        {
            content.EnableDetail(0, false);
            content.SetDetailShouldShowImage(1, false);
            content.EnableDetail(2, false);
            content.EnableDetail(4, true);
            content.SetDetailText(5, detail);
        }
        else
        {
            content.EnableDetail(0, true);
            content.SetDetailText(0, detail);
            content.SetDetailShouldShowImage(1, true);
            if (wi.count >= this.world.capacity)
            {
            }
            content.EnableDetail(2, true);
            content.SetDetailText(3, "#" + wi.idOnly + " " + accessDetail.shortName);
            content.EnableDetail(4, false);
            action = delegate
            {
                this.ShowWorldInstanceDetails(this.world, wi);
            };
        }
        content.Initialize(this.world.thumbnailImageUrl, this.world.name, action, this.world.id);
    }
Esempio n. 2
0
 // Token: 0x06005938 RID: 22840 RVA: 0x001EF878 File Offset: 0x001EDC78
 private void SetupPortalName(string name, ApiWorld.WorldInstance winst, ApiWorld world, string creator)
 {
     if (this.portalMarker != null)
     {
         this.portalMarker.roomName = name;
     }
     if (!string.IsNullOrEmpty(name) && winst != null && base.transform != null)
     {
         string text = name;
         if (world.capacity > 1)
         {
             text = text + " #" + winst.idOnly;
         }
         if (!string.IsNullOrEmpty(creator))
         {
             text = text + "\n" + creator;
         }
         ApiWorld.WorldInstance.AccessType   accessType   = winst.GetAccessType();
         ApiWorld.WorldInstance.AccessDetail accessDetail = ApiWorld.WorldInstance.GetAccessDetail(accessType);
         text = text + "\n" + accessDetail.shortName;
         Transform transform = base.transform.Find("NameTag/TextMesh");
         if (transform != null)
         {
             TextMeshPro component = transform.GetComponent <TextMeshPro>();
             if (component != null)
             {
                 component.text = text;
             }
         }
     }
 }
Esempio n. 3
0
 // Token: 0x060061C8 RID: 25032 RVA: 0x00227E20 File Offset: 0x00226220
 protected override void FetchAndRenderElements(int page)
 {
     if (this.world != null)
     {
         int num = 0;
         List <ApiWorld.WorldInstance> list = new List <ApiWorld.WorldInstance>();
         PageWorldInfo info = base.gameObject.GetComponentInParent <PageWorldInfo>();
         List <ApiWorld.WorldInstance> collection = new List <ApiWorld.WorldInstance>(this.world.worldInstances);
         list.AddRange(collection);
         list.RemoveAll((ApiWorld.WorldInstance i) => i.GetAccessType() == ApiWorld.WorldInstance.AccessType.FriendsOfGuests && i.GetInstanceCreator() != APIUser.CurrentUser.id);
         if (RoomManager.inRoom && RoomManager.currentRoom.id == this.world.id && RoomManager.currentOwnerId != APIUser.CurrentUser.id)
         {
             int count = PlayerManager.GetAllPlayers().Length;
             ApiWorld.WorldInstance            worldInstance = new ApiWorld.WorldInstance(RoomManager.currentRoom.currentInstanceIdWithTags, count);
             ApiWorld.WorldInstance.AccessType accessType    = worldInstance.GetAccessType();
             if (accessType == ApiWorld.WorldInstance.AccessType.InviteOnly || accessType == ApiWorld.WorldInstance.AccessType.FriendsOfGuests)
             {
                 list.Add(worldInstance);
             }
         }
         num += list.Sum((ApiWorld.WorldInstance wInst) => wInst.count);
         if (info != null)
         {
             list.RemoveAll((ApiWorld.WorldInstance i) => i.idWithTags == info.worldInstance.idWithTags);
         }
         int num2 = this.world.occupants - num;
         if (num2 > 0)
         {
             list.RemoveAll((ApiWorld.WorldInstance i) => i.GetAccessType() == ApiWorld.WorldInstance.AccessType.PrivatePopCounter);
             ApiWorld.WorldInstance item = new ApiWorld.WorldInstance("0" + ApiWorld.WorldInstance.BuildAccessTags(ApiWorld.WorldInstance.AccessType.PrivatePopCounter, string.Empty), num2);
             list.Add(item);
         }
         base.RenderElements <ApiWorld.WorldInstance>(list, 0);
     }
 }
Esempio n. 4
0
        // Token: 0x060060AB RID: 24747 RVA: 0x00220A00 File Offset: 0x0021EE00
        private void CreateNewInstanceByAccess(ApiWorld.WorldInstance.AccessType access)
        {
            string tags = ApiWorld.WorldInstance.BuildAccessTags(access, APIUser.CurrentUser.id);

            this.mWorldInfo.SetupWorldInfo(this.mWorld, this.mWorld.GetNewInstance(tags), true, false);
            this.Close();
        }
Esempio n. 5
0
 // Token: 0x06006072 RID: 24690 RVA: 0x0021F51C File Offset: 0x0021D91C
 private void ConfigurePortalButton(ApiWorld.WorldInstance.AccessType access, bool isMine, bool isInstanceFull, bool isInstancePublic)
 {
     this.portalButtonOnClickTrigger.triggers.Clear();
     if (this.isPortalMenu)
     {
         this.portalButton.gameObject.SetActive(false);
     }
     else
     {
         this.portalButton.gameObject.SetActive(true);
         Text   component      = this.portalButton.transform.Find("Text").GetComponent <Text>();
         bool   flag           = true;
         string disabledReason = string.Empty;
         if (!isMine && (access == ApiWorld.WorldInstance.AccessType.InviteOnly || access == ApiWorld.WorldInstance.AccessType.FriendsOnly || access == ApiWorld.WorldInstance.AccessType.FriendsOfGuests))
         {
             flag           = false;
             disabledReason = "You cannot create a portal to a private world created by another user.";
         }
         if (isInstanceFull)
         {
             flag           = false;
             disabledReason = "This world instance is currently filled to capacity.";
         }
         if (isInstancePublic && ModerationManager.Instance.IsBannedFromPublicOnly(APIUser.CurrentUser.id))
         {
             flag           = false;
             disabledReason = ModerationManager.Instance.GetPublicOnlyBannedUserMessage();
         }
         if (flag)
         {
             this.portalButton.interactable = true;
             component.color = Color.white;
             if (RoomManager.inRoom)
             {
                 this.portalButton.onClick.AddListener(new UnityAction(this.CreatePortalAndAskForPassword));
             }
         }
         else
         {
             this.portalButton.interactable = false;
             component.color = Color.gray;
             EventTrigger.Entry entry = new EventTrigger.Entry();
             entry.eventID = EventTriggerType.PointerClick;
             entry.callback.AddListener(delegate(BaseEventData data)
             {
                 if (!string.IsNullOrEmpty(disabledReason))
                 {
                     VRCUiPopupManager.Instance.ShowAlert("Cannot Create Portal", disabledReason, 10f);
                 }
             });
             this.portalButtonOnClickTrigger.triggers.Add(entry);
         }
     }
 }
Esempio n. 6
0
 static ApiWorld.WorldInstance.AccessDetail smethod_4(ApiWorld.WorldInstance.AccessType accessType_0)
 {
     return(ApiWorld.WorldInstance.GetAccessDetail(accessType_0));
 }
Esempio n. 7
0
 // Token: 0x0600603E RID: 24638 RVA: 0x0021E378 File Offset: 0x0021C778
 private bool CanInviteHere()
 {
     ApiWorld.WorldInstance            worldInstance = new ApiWorld.WorldInstance(RoomManager.currentRoom.currentInstanceIdWithTags, 0);
     ApiWorld.WorldInstance.AccessType accessType    = worldInstance.GetAccessType();
     return(this.isModerator || this.isInstanceOwner || (accessType == ApiWorld.WorldInstance.AccessType.Public || accessType == ApiWorld.WorldInstance.AccessType.FriendsOfGuests));
 }
Esempio n. 8
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();
        }
Esempio n. 9
0
        // Token: 0x06006074 RID: 24692 RVA: 0x0021F7B8 File Offset: 0x0021DBB8
        public void SetupWorldInfo(ApiWorld world, ApiWorld.WorldInstance instance = null, bool newInstance = false, bool isPortal = false)
        {
            if (instance == null)
            {
                instance = world.GetBestInstance(null, false);
            }
            this.mWorld           = world;
            this.worldInstance    = instance;
            this.openedFromPortal = isPortal;
            ApiWorld.WorldInstance.AccessType   accessType   = this.worldInstance.GetAccessType();
            ApiWorld.WorldInstance.AccessDetail accessDetail = ApiWorld.WorldInstance.GetAccessDetail(accessType);
            string str = string.Empty;

            this.roomName.text = world.name;
            string instanceCreator = this.worldInstance.GetInstanceCreator();

            str = accessDetail.shortName;
            this.instanceStatus.text = accessDetail.fullName;
            if (accessType == ApiWorld.WorldInstance.AccessType.Public)
            {
                this.roomAuthor.text = world.authorName;
                this.roomOwner.text  = world.authorName;
            }
            else if (accessType == ApiWorld.WorldInstance.AccessType.InviteOnly || accessType == ApiWorld.WorldInstance.AccessType.FriendsOnly || accessType == ApiWorld.WorldInstance.AccessType.FriendsOfGuests)
            {
                this.roomAuthor.text = world.authorName;
                this.roomOwner.text  = "(loading...)";
                APIUser.Fetch(instanceCreator, delegate(APIUser user)
                {
                    this.roomOwner.text = user.displayName;
                }, null);
            }
            this.playerCount.text     = this.worldInstance.count.ToString();
            this.maxPlayers.text      = world.capacity.ToString();
            this.worldInstanceId.text = "#" + this.worldInstance.idOnly + " " + str;
            Downloader.DownloadImage(world.imageUrl, delegate(string downloadedUrl, Texture2D obj)
            {
                this.roomImage.texture = obj;
            }, string.Empty);
            this.isPortalMenu = isPortal;
            this.ConfigureJoinButton(instance.count >= world.capacity, instance.isPublic);
            this.ConfigurePortalButton(accessType, instanceCreator == APIUser.CurrentUser.id, instance.count >= world.capacity, instance.isPublic);
            if (isPortal)
            {
                this.backButton.GetComponentInChildren <Text>().text = "Exit";
                this.backButton.onClick.AddListener(new UnityAction(this.Respawn));
                VRCUiManager.Instance.ShowScreen("UserInterface/MenuContent/Backdrop/Backdrop");
                VRCUiManager.Instance.HideScreen("HEADER");
                QuickMenu.Instance.CanExitWithButton = false;
            }
            else
            {
                this.backButton.onClick.AddListener(new UnityAction(this.BackToWorlds));
                this.backButton.GetComponentInChildren <Text>().text = "Back";
            }
            if (this.il != null)
            {
                this.il.world = world;
                this.il.Refresh();
            }
            if (world.releaseStatus == "public" || world.authorId == APIUser.CurrentUser.id)
            {
                this.newInstanceButton.interactable = true;
            }
            if (instance.count >= world.capacity)
            {
                this.playerCount.text = "Full";
            }
            this.SetCurrentInstanceMessage(string.Empty, false);
            if (RoomManager.inRoom)
            {
                ApiWorld currentRoom = RoomManager.currentRoom;
                if (currentRoom.id == world.id && currentRoom.currentInstanceIdWithTags == this.worldInstance.idWithTags)
                {
                    this.SetCurrentInstanceMessage("You are here", true);
                }
            }
            if (newInstance)
            {
                this.SetCurrentInstanceMessage("NEW INSTANCE", true);
            }
        }