Ejemplo n.º 1
0
        private static void OnSetPickerContentFromApiModel(UiUserList __instance, VRCUiContentButton __0, Il2CppSystem.Object __1)
        {
            if (!ShouldAdjustList(__instance))
            {
                return;
            }

            APIUser user = __1.TryCast <APIUser>();

            if (user == null)
            {
                return;
            }

            GameObject icon = __0.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0.First(gameObject => gameObject.name == "PrivateInstanceIcon");

            if (UserInstanceSprite(user) is Sprite sprite)
            {
                icon.GetComponent <Image>().sprite = sprite;
                icon.SetActive(true);
            }
            else
            {
                icon.SetActive(false);
            }
        }
Ejemplo n.º 2
0
        private static void OnUiUserListAwake(UiUserList __instance)
        {
            if (!ShouldAdjustList(__instance))
            {
                return;
            }

            GameObject         pickerPrefab = (GameObject)pickerPrefabProp.GetValue(__instance);
            VRCUiContentButton picker       = pickerPrefab.GetComponent <VRCUiContentButton>();

            if (picker.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0.Any(iconCheck => iconCheck.name == "PrivateInstanceIcon"))
            {
                return;
            }

            GameObject[] newArr = new GameObject[picker.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0.Length + 1];
            picker.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0.CopyTo(newArr, 0);

            GameObject icon = GameObject.Instantiate(picker.transform.Find("Icons/OverlayIcons/iconUserOnPC").gameObject);

            icon.name = "PrivateInstanceIcon";
            icon.transform.SetParent(picker.transform.Find("Icons/OverlayIcons"));
            icon.SetActive(false);

            newArr[newArr.Length - 1] = icon;

            picker.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0 = newArr;
        }
Ejemplo n.º 3
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);
    }
Ejemplo n.º 4
0
    // Token: 0x06006170 RID: 24944 RVA: 0x002264A4 File Offset: 0x002248A4
    public bool isCentered(VRCUiContentButton button)
    {
        float x   = button.transform.localPosition.x;
        float num = -base.content.localPosition.x;

        return(Mathf.Abs(x - num) < 200f);
    }
Ejemplo n.º 5
0
 // Token: 0x060061BA RID: 25018 RVA: 0x00225680 File Offset: 0x00223A80
 private void RemovePickersInRange(int index, int count)
 {
     for (int i = index; i < index + count; i++)
     {
         VRCUiContentButton vrcuiContentButton = this.pickers[i];
         vrcuiContentButton.transform.parent = null;
         vrcuiContentButton.ClearImage();
         SimplePool.Despawn(vrcuiContentButton.gameObject);
     }
     this.pickers.RemoveRange(index, count);
 }
Ejemplo n.º 6
0
 private static bool UIListPatch(VRCUiContentButton __0, Il2CppSystem.Object __1)
 {
     if (__1.Cast <ApiAvatar>().releaseStatus == "public")
     {
         __0.transform.Find("TitleText").GetComponent <Text>().color = Color.green;
     }
     else
     {
         __0.transform.Find("TitleText").GetComponent <Text>().color = Color.red;
     }
     return(true);
 }
Ejemplo n.º 7
0
    // Token: 0x060061D2 RID: 25042 RVA: 0x00228338 File Offset: 0x00226738
    protected override void SetPickerContentFromApiModel(VRCUiContentButton content, object am)
    {
        ApiWorld w = (ApiWorld)am;

        content.SetDetailText(0, (w.occupants <= 0) ? string.Empty : w.occupants.ToString());
        if (content.contentId != w.id)
        {
            content.Initialize(w.thumbnailImageUrl, w.name, delegate
            {
                this.ShowRoomDetails(w);
            }, w.id);
        }
    }
Ejemplo n.º 8
0
        private static void SetPickerContentFromApiModelPatch(ref VRCUiContentButton __0, ref Il2CppSystem.Object __1)
        {
            APIUser user    = __1.Cast <APIUser>();
            var     apiUser = PlayerWrappers.CachedApiUsers.Find(x => x.id == user.id) ?? user;

            if (Enabled.Value)
            {
                __0.field_Public_Text_0.color = GetTrustColor(apiUser);
            }
            else
            {
                __0.field_Public_Text_0.color = new Color(0.4139273f, 0.8854161f, 0.9705882f);
            }
        }
Ejemplo n.º 9
0
    // Token: 0x060061BB RID: 25019 RVA: 0x002256D8 File Offset: 0x00223AD8
    protected void CreatePickerFromApiModel(object am)
    {
        GameObject    gameObject = SimplePool.Spawn(this.pickerPrefab, Vector3.zero, Quaternion.identity);
        RectTransform component  = gameObject.GetComponent <RectTransform>();

        component.SetParent(this.content.transform);
        component.localScale    = Vector3.one;
        component.localPosition = new Vector3(component.localPosition.x, 0f, 0f);
        component.localRotation = Quaternion.identity;
        VRCUiContentButton component2 = gameObject.GetComponent <VRCUiContentButton>();

        this.SetPickerContentFromApiModel(component2, am);
        this.pickers.Add(component2);
    }
Ejemplo n.º 10
0
 public void GenerateButtonFromUser(VRCUiContentButton Button, object ButtonObject)
 {
     Utils.Log("LPEPONDFHLA called!");
     // MethodBase.GetCurrentMethod().Invoke(null, new object[] { Button, ButtonObject });
     if (ButtonObject is APIUser apiUser)
     {
         var location = apiUser.location;
         Utils.Log("Location of", apiUser.displayName, "is", location);
         if (location == "private")
         {
             Button.nameText.text += " (Private)";
             Utils.Log("Set", Button.nameText.text.Quote(), "for user", apiUser.displayName.Quote());
         }
     }
 }
Ejemplo n.º 11
0
 // Token: 0x060061B4 RID: 25012 RVA: 0x0022540C File Offset: 0x0022380C
 public void HideOffScreenElements()
 {
     for (int i = 0; i < this.pickers.Count; i++)
     {
         float num = this.content.GetComponent <GridLayoutGroup>().cellSize.x + this.content.GetComponent <GridLayoutGroup>().spacing.x;
         VRCUiContentButton vrcuiContentButton = this.pickers[i];
         if (vrcuiContentButton.transform.localPosition.x + num * 3f + this.content.transform.localPosition.x < 0f || vrcuiContentButton.transform.localPosition.x + this.content.transform.localPosition.x > num * 4f)
         {
             vrcuiContentButton.HideElement(true);
         }
         else
         {
             vrcuiContentButton.HideElement(false);
         }
     }
 }
Ejemplo n.º 12
0
 private static void OnSetPickerContentFromApiModelPrefix(VRCUiContentButton __0)
 {
     // For some reason, our icon just dies for whatever reason sometimes
     for (int i = 0; i < __0.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0.Count; i++)
     {
         if (__0.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0[i] == null)
         {
             GameObject icon = GameObject.Instantiate(__0.transform.Find("Icons/OverlayIcons/iconUserOnPC").gameObject);
             icon.name = "PrivateInstanceIcon";
             icon.transform.SetParent(__0.transform.Find("Icons/OverlayIcons"));
             icon.SetActive(false);
             icon.hideFlags |= HideFlags.DontUnloadUnusedAsset;
             __0.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0[i] = icon;
             return;
         }
     }
 }
Ejemplo n.º 13
0
    // Token: 0x0600615C RID: 24924 RVA: 0x00225EC0 File Offset: 0x002242C0
    protected override void SetPickerContentFromApiModel(VRCUiContentButton content, object am)
    {
        ApiAvatar av = am as ApiAvatar;

        if (content.contentId != av.id)
        {
            content.Initialize(av.thumbnailImageUrl, av.name, delegate
            {
                Debug.Log("Picked new avatar: " + av.name);
                this.avatarPedestal.Refresh(av);
                if (this.myPage != null)
                {
                    this.myPage.ChangedPreviewAvatar();
                }
            }, av.id);
        }
    }
Ejemplo n.º 14
0
 // Token: 0x060061B9 RID: 25017 RVA: 0x00225548 File Offset: 0x00223948
 protected void RenderElements <T>(List <T> list, int page)
 {
     if (list == null && this.hideWhenEmpty)
     {
         this.Hide(true);
         return;
     }
     if (list.Count == 0 && this.hideWhenEmpty)
     {
         this.Hide(true);
     }
     else
     {
         this.Hide(false);
     }
     if (this.isOffScreen)
     {
         return;
     }
     while (this.pickers.Count > list.Count)
     {
         VRCUiContentButton vrcuiContentButton = this.pickers[this.pickers.Count - 1];
         vrcuiContentButton.transform.SetParent(null);
         vrcuiContentButton.ClearImage();
         SimplePool.Despawn(vrcuiContentButton.gameObject);
         this.pickers.RemoveAt(this.pickers.Count - 1);
     }
     for (int i = 0; i < list.Count; i++)
     {
         object am = list[i];
         if (i < this.pickers.Count)
         {
             VRCUiContentButton picker = this.pickers[i];
             this.RefreshPickerFromApiModel(picker, am);
         }
         else
         {
             this.CreatePickerFromApiModel(am);
         }
     }
     if (base.gameObject.activeInHierarchy)
     {
         base.StartCoroutine(this.HideOffScreenElementsNextFrame());
     }
 }
Ejemplo n.º 15
0
 private static bool ButtonPatch(VRCUiContentButton __0, Il2CppSystem.Object __1)
 {
     try
     {
         APIUser oof = __1.Cast <APIUser>();
         if (oof.tags.Contains("admin_moderator"))
         {
             __0.field_Public_Text_0.color = UnityEngine.Color.red;
         }
         else if (oof.tags.Contains("system_legend"))
         {
             __0.field_Public_Text_0.color = new Color(1f, 1f, 1f);
         }
         else if (oof.tags.Contains("system_trust_legend"))
         {
             __0.field_Public_Text_0.color = new Color(1f, 1f, 0f);
         }
         else if (oof.tags.Contains("system_trust_veteran"))
         {
             __0.field_Public_Text_0.color = new Color(0.5f, 0.25f, 0.9f);
         }
         else if (oof.tags.Contains("system_trust_trusted"))
         {
             __0.field_Public_Text_0.color = new Color(1, 0.48f, 0);
         }
         else if (oof.tags.Contains("system_trust_known"))
         {
             __0.field_Public_Text_0.color = new Color(0.17f, 0.81f, 0.36f);
         }
         else if (oof.tags.Contains("system_trust_basic"))
         {
             __0.field_Public_Text_0.color = new Color(0.09f, 0.47f, 1f);
         }
         else
         {
             __0.field_Public_Text_0.color = UnityEngine.Color.grey;
         }
     }
     catch
     {
         //oof
     }
     return(true);
 }
Ejemplo n.º 16
0
    // Token: 0x06006307 RID: 25351 RVA: 0x00233A98 File Offset: 0x00231E98
    private void CreatePickerFromBlueprint(ApiAvatar b)
    {
        GameObject    gameObject = AssetManagement.Instantiate(this.pickerPrefab) as GameObject;
        RectTransform component  = gameObject.GetComponent <RectTransform>();

        component.SetParent(this.panel.transform);
        component.localScale    = Vector3.one;
        component.localRotation = Quaternion.identity;
        component.localPosition = new Vector3(this.defaultRect.width / 2f + (float)this.pickers.Count * this.spacing, 0f, 0f);
        VRCUiContentButton component2 = gameObject.GetComponent <VRCUiContentButton>();

        component2.list = this.list;
        component2.Initialize(b.imageUrl, b.name, delegate
        {
            User.CurrentUser.SetCurrentAvatar(b);
            VRCUiManager.Instance.HideScreen("SCREEN");
        }, b.id);
        this.pickers.Add(component2);
    }
Ejemplo n.º 17
0
 // Token: 0x0600616F RID: 24943 RVA: 0x00226498 File Offset: 0x00224898
 public void CenterOn(VRCUiContentButton content)
 {
     this.focus = content;
 }
Ejemplo n.º 18
0
 // Token: 0x060061BC RID: 25020 RVA: 0x00225767 File Offset: 0x00223B67
 protected void RefreshPickerFromApiModel(VRCUiContentButton picker, object am)
 {
     this.SetPickerContentFromApiModel(picker, am);
 }
 private void OnEnable() => selectedContentButton = transform.parent.GetComponent <VRCUiContentButton>();
Ejemplo n.º 20
0
 // Token: 0x060061BD RID: 25021
 protected abstract void SetPickerContentFromApiModel(VRCUiContentButton content, object am);
Ejemplo n.º 21
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);
        }
    }